x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Using path.php for Conditionals

If you are working with subdomains, it can be difficult to use segment conditionals or assigned variables for different purposes.

Here is a different way, using the path.php document that should be in the root of your domain folder as well as in the subdomain folder.

In the first path.php document you put

$global_vars = array(
"my_site" => "s1"
); // Last entry must not include the comma at the end

In the second path.php document (in the subdomain) you simply change “s1” so “s2” and so forth.

Then, you make a conditional where you need it. Below is an example of how to change the title of the document depending if you’re on you main domain or on your subdomain:

<title>
{if my_site == 's1' AND segment_1 == ""}
                          Welcome to my domain
       
{if
:else my_site == 's2' AND segment_1 == ""}
                          Welcome to my subdomain
{
/if}
</title>

This solution was created by Robin Sowell in response to a forum question.

Category:Tips

Categories: