[Typo3-dev] make path relative to TYPO3_DOCUMENT_ROOT

Thomas Murphy murphy at thepanemgroup.com
Sun Sep 26 07:32:14 CEST 2004


Wolfgang Klinger wrote:
>>like: /var/www/mysite.com/fileadmin/mytext.txt
>>to: /fileadmin/mytext.txt
> 
>  Just use substr to remove PATH_site...
> -------
> relPath = substr($absPath, strlen(PATH_site));
> -------

Thanks Wolfgang! That showed me the right direction...
But actually something like that:

$relPath = 
substr($filepath,strlen(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')));

worked better for me, because it also works for sites lying in a 
subfolder below their 'webroot' e.g. http://www.mysite.com/mysite/
Your solution also cutted off the '/mysite/'

bye,
Thomas





More information about the TYPO3-dev mailing list