[TYPO3] dynamic text replacement based on domain

Tyler Kraft tyler.kraft at netefficiency.co.uk
Thu Nov 15 11:57:42 CET 2007


A few lines of TS is all you need.

ok well you can use the domain as a condition like this in the template 
setup:
[globalString = HTTP_HOST= *typo3.com]

[globalString = HTTP_HOST= *anotherdomain.co.uk]

[global]

and then use the "short" property of parseFunc within those conditions 
and have it replace all occurances of COMPANYNAME in your content.

hth



Daniel Mark wrote:
> I have several domains directed to the same site tree within Typo3. I 
> need to change instances of the company name within pagecontents 
> depending on which domain the user visits from.
> 
> Right now, I'm successfully using the stfl_replacer extension[1] to 
> replace those instances. (Thanks for the tip, Bartosz!) But I need to 
> dynamically configure the <replacement> tag based on domain, something 
> like this:
> 
> ...snip..
> <replace index="0">
>     <pattern><![CDATA[&lt;companyName&gt;]]></pattern>
>     [globalString = HTTP_HOST=www.companyA.com]
>         <replacement>Company A</replacement>
>     [end]
>     [globalString = HTTP_HOST=www.companyB.com]
>         <replacement>Company B</replacement>
>     [end]
> </replace>
> ...snip..
> 
> Obviously I can't do conditions within my page TSconfig, so I need a 
> different strategy. I'm still new to Typo3 so I'm not sure how else to 
> approach this. [Is there a way I can set a global variable|constant 
> somewhere else and then reference it in my TSconfig?]
> 
> Any help would be appreciated, thanks!
> 
> Daniel
> 
> 
> [1] http://typo3.org/extensions/repository/view/stfl_replacer/0.3.1/


More information about the TYPO3-english mailing list