Adding site_id to component 13 Years, 10 Months ago
|
Karma: 0
|
Hello,
Is the site_id a global information which i can add to any component to specify a path
eg. /users/site_id/.... ?
thanks,
Marcel
|
|
|
|
|
Re: Adding site_id to component 13 Years, 10 Months ago
|
Karma: 54
|
If don't really understand the question and the relationship with a component.
If your question is relative to the setup of a slave site in "manage site" menu then you can use the keyword {site_id}.
If your question is relative to know how to get the site ID in a PHP code then you can use the "MULTISITES_ID" define variable. It is only filled for a slave site or does not exists when this is the master.
|
|
|
|
|
Re: Adding site_id to component 13 Years, 10 Months ago
|
Karma: 0
|
Hello,
thanks for your reply.
Let me explain what i want to do:
All my slave sites are using the same Master DB.
As i need to display different contact information for each site my plan was to modify the standard contact page file that it shows an individual php file which is saved in each slave directory. To specify the path i need the multisites_id.
Can this be done using the multisites_id plugin?
And is the multisites_id variable handled like normal variables?
(for example will echo $multisites_id work ?)
This might not be a big deal but for someone likne me (with more or less no php knowledge it's not so easy)
thanks !
Marcel
|
|
|
|
|
Re: Adding site_id to component 13 Years, 10 Months ago
|
Karma: 54
|
When you are runing as a slave site you have the define value "MULTISITES_ID" that is setup with the Site ID.
When the define does not exists, this mean that you are on the master.
So you can echo the Site ID.
The plugin is used to perform a "Search / Replace" of a tag with the Site ID.
For example, you can use it to set the value of a "hidden" field with the "Site ID".
|
|
|
|
|
Re: Adding site_id to component 13 Years, 2 Months ago
|
Karma: 0
|
Hi there,
In several places I've tried to return $MULTISITES_ID (and variants like $multisites_id), and I can't seem to get it.
I'm looking to edit a plugin (Kunena discuss) to include the Site ID in its table to identify the origin of the content. How do I reference the appropriate variable in a plugin? Can you give a sample of the syntax?
Thanks!
|
|
phleum
Fresh Boarder
Posts: 13
|
|
|
Re: Adding site_id to component 13 Years, 2 Months ago
|
Karma: 54
|
This is NOT $MULTISITES_ID but MULTISITES_ID without the Dollar ($) sign.
This is not a variable but a define that is available everywhere when you are runing a slave site.
$site_id = defined( 'MULTISITES_ID') ? MULTISITES_ID : ':master_db:';
|
|
|
|
|
|