English (United Kingdom)
Jms Multi Site, formerly joomla multisite.
Create, share multiple joomla sites in few clicks !
Message
  • EU e-Privacy Directive

    This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

    View e-Privacy Directive Documents

Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottomPage: 1
TOPIC: Determine site_id in PHP?
*
#1058
Determine site_id in PHP? 14 Years, 10 Months ago Karma: 0
Is is possible (without parsing the baseurl) to determine the site_id from within the PHP code?

Like if I want to have custom CSS styles even though each slave has the same theme
Code:

<body class="<?php echo $this->site_id; ?>">


Or if I want to change the layout of a component based on the site id
Code:


function display($tpl = null)
{
if ( $this->site_id == 'slave1') $tpl = 'blue';
else if ($this->side_id == 'slave2') $tpl = 'green';
...
}

meteu336
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1060
Re:Determine site_id in PHP? 14 Years, 10 Months ago Karma: 54
YES.

The site id is saved iin MULTISITES_ID define.
When this is a slave, the MULTISITES_ID is defined.
When not defined, this is the master website.

Code:

<body class="<?php echo (defined( 'MULTISITES_ID' ) ? MULTISITES_ID : 'master_class' ); ?>">




Code:

function display($tpl = null) 

   // If Master
    if ( !defined( 'MULTISITES_ID' ) $tpl = 'blue'; 
    else if (MULTISITES_ID == 'slave1' ) $tpl = 'green'; 
    ... 
}

edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
Last Edit: 2009/06/15 10:00 By edwin2win.
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop
2Win, Multisite(s) are trademarks of Edwin2Win.
Joomla