Re: Output absolute paths
One thing you can do is use the "generateFrontendUrl" hook. This hook is called any time a URL is generated by the system (of course if you have any URLs that are hard-coded -- maybe in a WYSIWYG box or something, you'll have to change them manually).
http://www.contao.org/en/hooks.html#generateFrontendUrl
It would look something like this:
/system/modules/customurls/config/config.php:
Code:
$GLOBALS['TL_HOOKS']['generateFrontendUrl'][] = array('CustomUrls', 'forceAbsolute');
/system/modules/customurls/CustomUrls.php:
Code:
class CustomUrls extends Frontend
{
public function forceAbsolute($arrRow, $strParams, $strUrl)
{
return $this->Environment->url . '/' . $strUrl; // I forget if the '/' is needed...
}
}
That's an oversimplified solution -- you'll probably want to add some extra checks to $strUrl first (for example, to make sure it isn't already absolute). But it's the gist of what you want.
For links in TinyMCE, there's an option to force those to be absolute too:
http://www.tinymce.com/wiki.php/Configu ... ative_urls
http://www.tinymce.com/wiki.php/Configu ... nvert_urls (just in case).
Re: Output absolute paths
Hi medianomaly,
thanks for your reply.
What is customurl ? where doyou find it ?
thanks
Re: Output absolute paths
So far, i have filled the fields in "DNS settings" for my images folder, plugins folder and scripts folder, but it doesn't include the modules folder.
Your scripts works, but only on href attributes, not on src attributes
Re: Output absolute paths
Hmm... If you need images too, I'm not sure what the best way is to do that.
There's another hook (getImage), that works similar to the one used in the code I posted, but I don't know if that would work. Images that don't need resizing might not call it (not sure though).
http://www.contao.org/en/hooks.html#getImage
Otherwise you may have to do something like add the domain to the paths of all your template code... Maybe someone knows a better way.
I wonder if you could do this all with .htaccess rules? Like rewrite all requests to force the full absolute path... If that's possible it would be even better because your paths could stay how they are now (the redirect would be invisible). Unfortunately I'm no expert on this part.