[TYPO3] How to get domain name thru typoscript

Elijah elijah.alcantara at gmail.com
Wed Dec 26 13:13:29 CET 2007


Thank you for spotting my mistakes there, no wonder it isn't working.

What I was actually trying to do is to grab the domain name record for 
each menu item(if there is any), the code you've given me works great 
for my site but when used in a menu and a particular menu item has it's 
own domain name it will still fetch the current domain.


Christopher Torgalson wrote:
> Hi,
> 
> Elijah wrote:
>> Hi,
>>
>> I'm just trying to get a domain name :
>>
>> lib.currentdomain = TEXT
>> lib.currentdomain {
>> data = DB : sys_domain : {GPvar:pid} : domainName
>> data.wrap3 = {|}
>> data.insertData = 1
>> }
>>
>>
>> I followed that snippet somewhere from this list but it doesn't work, 
>> it will only work when I replace {GPvar:pid} with the correct pid 
>> number from a domain record.
> 
> 
> The question is 'what do you expect GPvar:pid to return (and why?)' The 
> 'GP' part of 'GPvar' stands for GET/POST, so for your TS to work there'd 
> need to be a parameter in the url or in the POST array (unlikely if you 
> didnt' get to the current page by submitting a form) called 'pid'. If 
> neither of these is present, GPvar:pid--and therefore the entire TS 
> snippet--will not return anything.
> 
> Besides all that, even if there was a 'pid' parameter in the url or in 
> the POST array, it would have to somehow correspond to the uid of the 
> domain record for the current domain (which is also unlikely unless 
> you've set your site up that way deliberately).
> 
> If you're just trying to get the current domain name for any given page, 
> something like this works ok:
> 
> lib.currentdomain = TEXT
> lib.currentdomain {
>     data = getEnv:HTTP_HOST
> }
> 
> 


More information about the TYPO3-english mailing list