How do I make working this code? {if $site ==

Rostyslav
Rostyslav's picture

Joined: 2006-10-22
Posts: 22
Posted: Sat, 2010-04-17 09:27

I have 3 sub-domains and would like to use different analytics code.

Could you please help me. How do I make working this code?

{if $site == "site1.domain.com" or $site == "site1"}
{g->theme include="site1_analytics.tpl"}
{elseif $site == "site2.domain.com" or $site == "site2"}
{g->theme include="site2_analytics.tpl"}
{else}
{g->theme include="else_analytics.tpl"}
{/if}

Thanks a lot!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sat, 2010-04-17 12:18

you must first define your $site variable:

{php}$this->assign('site', $_SERVER['HTTP_HOST']);{/php}
{if $site == "site1.domain.com" or $site == "site1"}
{g->theme include="site1_analytics.tpl"}
{elseif $site == "site2.domain.com" or $site == "site2"}
{g->theme include="site2_analytics.tpl"}
{else}
{g->theme include="else_analytics.tpl"}
{/if}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
Rostyslav
Rostyslav's picture

Joined: 2006-10-22
Posts: 22
Posted: Sat, 2010-04-17 12:46