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.

 

Quick Recipe Question

Quick Recipe Question

Hello!

Looking to use your recipe "Show a module on every page that another module does not appear" and would like to know how to name more than one id.

For example from this...

$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();

$not_there = ($row == null or $row->c == 0);

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

...I need to be able to name more than one id in line one....something like this...

$moduleid = 23, 24, 25, 26, 27; /* 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();

$not_there = ($row == null or $row->c == 0);

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

...but have no idea what the proper coding is.

Basically, if module a, b or c is NOT showing then show module d.

Any ideas?

Thanks very much for this fantastic module...am using it with great success on a site already.

Skipper
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Quick Recipe Question

Hi Skipper,

try this:

Code:

$moduleids = "(23, 24, 25, 26, 27)"; /* 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 in ' . $moduleids;

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

$not_there = ($row == null or $row->c == 0);

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

I think that will do what you want.

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

Re: Quick Recipe Question

Stephen,

Thanks for the quick reply!

Skipper
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Quick Recipe Question

Stephen,

Okay...tried that out and am getting the mod showing on all pages rather than just the target pages. The issue...

Joomla 1.5
Kunena Forum 1.5.7 ( www.kunena.com )
website - www.hiltonheadrealestatemarketreports.com

On the forum pages currently able to have various mod's showing on various forum topics by using "descriptions" and your "Control modules based on page content/keywords/description" Recipe...which is awesome.( example here - http://hiltonheadrealestatemarketreport … et-reports )

Also using various other recipes to display various mods on left and right sidebars...which is great.

The problem I'm having is I'd like to display some modules just on the "main" forum page (eg: http://hiltonheadrealestatemarketreport … et-reports) and on the listcat pages (eg: http://hiltonheadrealestatemarketreport … ts/listcat). The issue is I don't believe using the "Control modules based on page content/keywords/description" will work as none of the three variables in these cases is unique from other pages.

Was looking at using the recipe above to name all current modules and if none of them (aka if no modules are showing as every other page has at least one mod currently in place) then display mod X.

Sorry this got a little long and I hope I'm making sense. If you're able to offer a suggestion it would be great. Either way love the module...been a life saver for a total non-programmer.

Thanks again,

Skipper
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Quick Recipe Question

Hey Skipper,

Have you tried turning on Advanced Debug mode while viewing those 2 pages? (the main forum page and the listcat pages). Can you post the results of those here? I'll probably have to modify the code for the main page, since it's more about what's *not* in the URL than what's actually in it. The recipe for the listcat page probably won't need so much tweaking.

I'm thrilled that the content/keywords/description recipe has been so useful. I can see the targeted module on the page there - great!

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

Re: Quick Recipe Question

Stephen,

With a little more digging around I was able to get a metamod showing on the listcat pages using the method you described and a bit of help from your write up under "Page Identification" however the Kunena Main Forum page still remains an issue...here is the code that displays for these pages...

Forum Category List Page (/.../.../listcat) - SOLVED - Got mod to show using below code:

if (
$option == 'com_kunena'
and JRequest::getVar('catid') == '35'
and $Itemid == '5'
and JRequest::getVar('func') == 'listcat'
) return XXX; /* replace XXX with the module ID or position to display */

MAIN Kunena Forum Page - NOT Solved...using below code displays mod on all Kunena Forum Pages rather than just the first/main page of the forum.

if (
$option == 'com_kunena'
and $Itemid == '5'
) return XXX; /* replace XXX with the module ID or position to display */

Thanks very much for all your help with this...can't tell you what a huge help it is.

Skipper
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Quick Recipe Question

Try this:

if (
$option == 'com_kunena'
and JRequest::getVar('func') == ''
) return XXX; /* replace XXX with the module ID or position to display */

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

Re: Quick Recipe Question

Stephen,

Tried out that code and it displays the module on all Kunena Forum pages.

I'll keep playing around with it and let you know if I come up with something.

Thanks!

Skipper
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Quick Recipe Question

Are you sure that you have it set up right? e.g. the target module is definitely either disabled or set to display on "none" pages?

You can test that by disabling the MetaMod. If the target module continues to display then it must be doing it outside of MetaMod's control...

If that's not the case, then there's something up with the rule... strange, from the advanced debug output that you sent, the listcat page should definitely be setting JRequest::getVar("func") to something other than "", so the rule should be correct.

One last thing - make sure you don't have anything in the Quick module ID include box.

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10746
Newest User:
victor1234
Members Online:
0
Guests Online:
255

Online: 
There are no members online

Forum Legend:

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