[TYPO3] Automating the <base> url tag

Christopher Torgalson bedlamhotel at gmail.com
Mon Apr 28 14:03:25 CEST 2008


Hi,

On Mon, Apr 28, 2008 at 1:19 PM, Elijah Alcantara
<elijah.alcantara at gmail.com> wrote:
> Hello,
>
>  I have a lib.domain ts that outputs the current domain name, I'd like
>  to apply this to the baseurl of the site like this:
>
>  config.baseURL < lib.domain
>
>  But I guess that is not the proper way... I get a "TEXT" value in it instead.
>
>  I've then tried adding the <base href="domainname" /> into the
>  page.headerData , it worked... but party, It seems that some css are
>  now lost since the base tag is now below the styles css when viewed
>  from the html source.
>
>
>  Is there a better way of doing this? and am I replicating the baseURL
>  = 1 security issue?


Question: are you using a finite and known set of domains? If so, then
something like this:

[globalString = HTTP_HOST=*example.com]
   lib.siteName = example.com
[globalString = HTTP_HOST=*example.ca]
   lib.siteName = example.ca
[globalString = HTTP_HOST=*example.net]
   lib.siteName = example.net
[global]

...in the constants field of the template, and something like this:

config.baseURL = http://www.{$lib.siteName}/

...in the setup field works. If you've got a non-finite or
indeterminate set of domains, I can't think of an immediate solution…

-- 
Christopher Torgalson
http://www.typo3apprentice.com/


More information about the TYPO3-english mailing list