[TYPO3] Automating the <base> url tag
Ernesto Baschny [cron IT]
ernst at cron-it.de
Tue Apr 29 10:32:48 CEST 2008
Elijah Alcantara wrote: on 28.04.2008 13:19:
> 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?
I guess this is not possible with current TYPO3 without XCLASSing
class.tslib_pagegen.php. This class will add the <base href> header from
the config.baseUrl TypoScript setting, which is a static setting and you
can only change that using pure TypoScript syntax (conditions), no
content objects allowed. Since the <base href> header needs to come
right at the start of your <head>, there is no other "dynamic" way to
add something there by yourself (no hook, no cObject processing...).
And XCLASSing that method renderContentWithHeader is pretty "ugly",
because it is a rather huge method.. :(
In my special case where I needed that, I "patched" that class on my
specific installation in that I moved the "// Headerdata" rendering
right above the shortcutIcon rendering, so I could use that to generate
my <base href>:
page.headerData.1 < plugin.tx_cronbasehrefgenerator_pi
Cheers,
Ernesto
More information about the TYPO3-english
mailing list