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.

 

Show module with module

Show module with module

Hi,

I am looking for a recipes to show a module (custom html) only with another module.  I can manually do this, but if I add another page to the module I have to remember to do them both.

Thank you
Regards
Lene

lt635
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Re: Show module with module

That's an interesting scenario. Actually there's a recipe in the documentation for achieving the reverse of that (displaying a module on every page where another specific one is NOT assigned). This is just for Joomla 1.5:

http://www.metamodpro.com/metamod/recip … not-appear

So a small change to this will allow you to assign a module to every page where another module IS assigned. You could do it like this:

Code:

$moduleid = 23; /* the module we are checking for. Customise this! */

$sql = 'SELECT count(*) as c from #__modules m, #__modules_menu mm ' .
  'WHERE mm.moduleid = m.id ' .
  'and m.published = 1 ' .
  'and (mm.menuid = ' .
  (int)$Itemid . ' or mm.menuid = 0) and mm.moduleid = ' . (int)$moduleid;

$db->setQuery( $sql, 0, 1 );
$row = $db->loadObject();

$assigned = ($row != null and $row->c > 0);

/* replace 101 with module id to display when the other module IS assigned to this page */
if ($assigned) return 101;

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
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10118
Newest User:
jack67484
Members Online:
2
Guests Online:
180


Forum Legend:

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