Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Show on all pages except default page
Show on all pages except default page
Show on all pages except default page
Hi
I looked at your recipe for showing on all pages except default home page but its not working, in fact I think the recipe for this looks the same as the recipe above to place module only on the front page: http://www.metamodpro.com/metamod/recip … front-page or maybe my eyes are deceiving me cos its 1am lol
Would you be able to help me please, also what if I wanted to extend this and say except home page and xxx page and xxx page. Also If I wanted to do this for a number of different modules would I write it all in one recipe or create a new metmod module with recipe for each module?
URL: http://79.170.44.105/fashionsfinest.com/
Recipe Used:
$menu =& JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) return 71;
Debug said this:
MetaMod debug info:
Module ID: 128
$option: com_k2
$view: itemlist
$id: 75
$Itemid: 102
$timezone: default
$language: en-us
$language_code: en
$language_region: us
Including modules:
Many Thanks
Re: Show on all pages except default page
Hi,
if the debug output above is from the front page, then it might be best to detect it from the URL parameters directly, like this:
$frontpage = ( $option == "com_k2" and $view == "itemlist" and $Itemid == 102 and $id == 75 );
if ($frontpage ) return;// return with no module id
return XXX;
If you want to put in several things that it's not allowed to be, then you can put in extra lines with conditions that will return nothing, like this:
$frontpage = ( $option == "com_k2" and $view == "itemlist" and $Itemid == 102 and $id == 75 );
if ($frontpage ) return;// return with no module id
if ($core_genius->check("pagetype = search")) return;
if ($content_genius->check("pagetype = article")) return;
return XXX;
In that way, if MetaMod can meet any of those conditions then it "short circuits" and returns with no modules selected. It will only include module "XXX" if it gets to the end of the list. Make sense?
Lastly, you were asking about how to do this with multiple modules.
If all the modules are in the same module position, then all you have to do is to return a list of the module ids, instead of just XXX.
e.g. the last line above would be:
return "XXX, YYY, ZZZ";
If the modules are in different module positions then you need to create a new MetaMod in each position, and repeat the rule in each (each one returning the relevant module id).
Trust that helps,
Stephen
Re: Show on all pages except default page
hi Stephen,
i know this thread is quit old but i have a similar issue.
i use Metamod version 2.12 on Joomla 1.5 and use it to to show a Module with quick module id 107 for Non-logged in users only. the module is now visible on all pages including default frontage.
how can i exclude the frontpage and where shall i add the code from this tutorial?
http://www.metamodpro.com/metamod/recip … front-page
here is my advanced debug output:
MetaMod debug info:</b><br /><i>Module ID:</i> 327<br /><i>$option:</i> com_community<br /><i>$view:</i> frontpage<br /><i>$id:</i> <br /><i>$Itemid:</i> 10<br /><i>$timezone:</i> Etc/GMT-1<br /><i>$language:</i> de-de<br><i>$language_code:</i> de<br><i>$language_region:</i> de<br>Non-logged-in users only; found non-logged-in user.<br />Including modules: 107<br /> <table cellpadding="0" cellspacing="0" class="moduletable">
many thanks
Re: Show on all pages except default page
Can you please post the rest of the debug output, and not including the PHP tags? It should give you a snippet of PHP code. Don't forget to set it to ADVANCED debug mode, not just standard debug.
Thanks,
Stephen
Re: Show on all pages except default page
metamodguy wrote:
Can you please post the rest of the debug output, and not including the PHP tags? It should give you a snippet of PHP code. Don't forget to set it to ADVANCED debug mode, not just standard debug.
Thanks,
Stephen
if (
$option == 'com_community'
and $view == 'frontpage'
and $Itemid == '10'
) return XXX; /* replace XXX with the module ID or position to display */
MetaMod debug info:
Module ID: 327
$option: com_community
$view: frontpage
$id:
$Itemid: 10
$timezone: Etc/GMT-1
$language: de-de
$language_code: de
$language_region: de
Non-logged-in users only; found non-logged-in user.
Including modules: 107
Re: Show on all pages except default page
Hi,
since your frontpage is a com_community frontpage rather than a standard "joomla" frontpage view, you could do the following to exclude the module from showing on that page:
if (
$option == 'com_community'
and $view == 'frontpage'
and $Itemid == '10'
) return; // i.e. show nothing on the front page
else return XXX; // show module XXX on all other pages
// replace XXX with the module id of the module you want to display.
If you were previously using the "quick module id or position include" box, you need to now remove the module id from that box, as it will now be taken care of by the PHP code.
Cheers,
Stephen
Re: Show on all pages except default page
hello Stephen,
many thanks it works perfect:)
could please give me a example for the same on "Show modules on front page
but not on all other pages"
thanks in advance ;-)
Edit:
i'v added the following and it works also:
if (
$option == 'com_community'
and $view == 'frontpage'
and $Itemid == '10'
) return 357; // i.e. show module id only on the front page
else return; // show module XXX on all other pages
// replace XXX with the module id of the module you want to display or set just return.
- Index
- » MetaMod
- » MetaMod General Support
- » Show on all pages except default page
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 3
- User Info:
- Total Users:
- 8012
- Newest User:
- grant1ab
- Members Online:
- 0
- Guests Online:
- 184
- 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