Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.


smithian
Beginner Modder
ranks
useravatar
User Info

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


Administrator has disabled public posting
metamodguy
useravatar
User Info

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

Administrator has disabled public posting

Board Info

Board Stats:   Total Users: 3096  Total Topics: 1195  Total Polls: 7  Total Posts: 4450  Posts this week: 15
User Info:   Newest User :  consyder   Members Online: 1   Guests Online: 110
Online 
consyder
Topic
New
Locked
Topic
New
Locked
Sticky
Active
New/Active
Sticky
Active
New/Active
New/Closed
New Sticky
Closed/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky Active Locked
Active/Sticky
Sticky/Locked
Sticky/Active/Locked