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.

 

Hide module when article ID is checked and found

Hide module when article ID is checked and found

Hi stephen, I want to hide a module when an article ID is found on the page. I tried this without success:

Code:


if ( $content_genius->check( "article_id= 779" ) return false;
else return true;

I get this error:

Code:

Parse error: syntax error, unexpected T_RETURN in /home/guitar88/public_html/modules/mod_metamod/helper.php(537) : eval()'d code on line 5

Cheers,
Alex

Edited By: atherrien
19-Feb-11 18:08:37

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Hide module when article ID is checked and found

It's just a missing parenthesis... I often make this typo too.

Try:

if ( $content_genius->check( "article_id = 779" )) return false;
else return true;

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

Re: Hide module when article ID is checked and found

I tried the new code in the metamod that I want to hide when article ID 779 prints but it doesn't work. I tried with the "check article_alias" but still nothing.

I think it might be conflicting with the php command in that same module, but i'm not too sure about it. It should work... any idea?

Code:

$mainframe =& JFactory::getApplication();

$template =& $mainframe->getTemplate();

if ($template == "femmes_jan2011") return "367";

if ( $content_genius->check( "article_id = 779" )) return false;
else return true;

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Hide module when article ID is checked and found

One of the differences between using PHP code in MetaMod vs. MetaTemplate is that in MetaMod you need to return a module ID number or a module position name, whilst in MetaTemplate you return either true, false, or a template name.

Therefore in the PHP above it looks like a mixture of both!

Do you want to return module 367 only if the template is femmes and the article is NOT 779?

If so, you could do it this way:

Code:

$mainframe =& JFactory::getApplication();

$template =& $mainframe->getTemplate();
if ( $template == "femmes_jan2011"
  and $content_genius->check( "article_id not = 779") {
    return 367;
}

Of course, there are many possible variations...

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

Re: Hide module when article ID is checked and found

Yes exactly, it works fine. There was a parenthesis missing after the article ID, just like the previous mistake I've done and you confirmed it.

Cheers, it's done.
Alex

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Dormant:
User Info:
 
Total Users:
5582
Newest User:
raselahmed
Members Online:
2
Guests Online:
112


Forum Legend:

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