Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide module when article ID is...
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
19-Feb-11 18:08:37
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;
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;
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
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Hide module when article ID is...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 202
- 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