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?

Retrieve Site ID (Multisites ID Plugin) via PHP
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Retrieve Site ID (Multisites ID Plugin) via PHP
*
#4336
Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 0
I'm using JMS in combination with Fabrik. I have a Fabrik element that I need to populate with the JMS site ID. What is the PHP code that I need to run on the Fabrik element to retrieve that value?
mediacake
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4340
Re: Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 54
You can either use a hidden field for which you assign a specifc default value like {{site_id}} and combine it with the Multisites ID plugin or directory code in PHP the behavior for a special field type that would be computed base on the MULTISITES_ID define. When it is defined, it contain the site_id otherwise, this is the master.
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4342
Re:Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 0
I've tried using {{site_id}} as the field value, but it just evaluates to "{{site_id}}". Could you give me some example PHP code that would let me retrieve this value?
mediacake
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4347
Re:Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 54
this is explained in my previous post. If you are a PHP developer, you should know what mean "use the define MULTISITES_ID".
Read the PHP multisites ID plugin code if you want to see how to do.

$variable = MULTISITES_ID;
edwin2win
Moderator
Posts: 5370
graph
User Offline Click here to see the profile of this user
Last Edit: 2010/06/06 16:25 By edwin2win.
The administrator has disabled public write access.
 
#4348
Re:Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 0
It's not a good idea to alienate your paying customers. I'm a PHP developer out of necessity, and relatively inexperienced. I'm also used to forums where paid customers receive the answers and the help they're looking for from the developers/admins. A few lines of code that you already know how to write would be much quicker and more helpful than saying "[I] should know what [you] mean". I guess I'll try to figure it out and post back here when it's working so that other people wondering how to do this will have functional example to work from.
mediacake
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#4349
Re:Retrieve Site ID (Multisites ID Plugin) via PHP 14 Years, 6 Months ago Karma: 0
Working Example:

Code:

if(defined('MULTISITES_ID')) {
  return constant('MULTISITES_ID');
} else {
  return ':master_db:';
}



Tested this on the master site, a slave template site and a general slave site and all is well. Hope it helps someone.
mediacake
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12
get the latest posts directly to your desktop
2Win, Multisite(s) are trademarks of Edwin2Win.
Joomla