Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Synchronise module position

Synchronise module position

Hi,
I want to specify that various modules get loaded into the footer position from information I enter into the component. So, I would specify a module id in the component (e.g. SOBI2's category description) and that module would appear in the footer only when the category I edited appears. That would synchronise the category and the related footer module content.

Is that possible?

Cheers,
Ian

smithian
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: Synchronise module position

Hi Ian,

that's an excellent question. I have done similar things with the content component, by using the meta-keywords field to add either module ids or special keywords that get picked up by MetaMod and used to determine which modules get displayed.

To use this technique for SOBI2 you would need to find a suitable "field" to add a keyword to, where it's not going to be shown to the public. Can you make your own custom fields in SOBI2?

Then you need to find where in the database this is stored, and then query the database to get this information when the MetaMod detects that a SOBI2 item is being displayed.

From the SOBI2 recipe page on this site:

http://www.metamodpro.com/metamod/recip … obi2-pages

You can use this to detect that you are on an entry page and retrieve the id of the item:

if ( $option == "com_sobi2" and JRequest::getVar('sobi2Task') == 'sobi2Details' ) {
  $sobi2Id = JRequest::getVar( 'sobi2Id' );
  //... do something with it here
}


Then to retrieve something from one of the SOBI2 tables it might be something like this. Here, I am retrieving module ids from the metakeywords field of SOBI2 entries. So if you put in a keyword like MOD_123 then it will display module 123.

if ( $option == "com_sobi2" and JRequest::getVar('sobi2Task') == 'sobi2Details' ) {
  $sobi2Id = JRequest::getVar( 'sobi2Id' );
  $query = 'SELECT metakey from #__sobi2_item
      WHERE itemid = ' . $db->quote($db->getEscaped( $sobi2Id ));
  $db->setQuery( $query );
  $res = $db->loadResult();
  if ($res) return;
  $m = preg_match("#MOD_([^.,]+)#", $res, $matches);
  if ($matches) {
    return @$matches[1];
  }
}


Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4386
Newest User:
verlywl7
Members Online:
1
Guests Online:
535

Online: 
verlywl7

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked