Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
Help for module in component content
Help for module in component content
Hallo folks,
i have try many hours to undurstand how could show a specific module in a secific page generate from a component, in joomla with SEF enable. is it possibile?
I have the "Joomla Tag" component for manage tags in article,
How can my site show a module when click on a tag on tagscloud, and a list of article is generate from this component, it's now I would like show a specific module.
how can I do?
thanks a lot
Giovanni Alberto
Re: Help for module in component content
Hi Giovanni,
yes, this is almost always possible. It's no problem to have SEF URLs turned on, although they make it a little more difficult to find the exact parameters to use, since the SEF URLs hide the parameters.
If you are able to temporarily turn off the SEF URLs then you'll be able to see the underlying parameters in the URL, and it's these that you need in order to write your PHP rules.
e.g. you might see a URL like this: (completely made up - I don't know what yours will be)
...index.php?option=com_tagcloud&view=item&tag=foobar&Itemid=84
In that case I'd use a rule like:
Code:
if ($option == "com_tagcloud" && $view == "item" ) {
/* (note: $option and $view are pre-populated -- any others you have to get manually like below ) */
$tag = JRequest::getVar("tag");
if ($tag == "foobar") return 101; /* customise module id here */
}
That's just a general way of going about it, but I hope that it will get you on the right track.
Another way of getting the parameters without having to turn off your SEF URLs, is to put the following rule (temporarily) into your PHP box in the MetaMod:
echo "<pre>"; print_r($_GET) ; echo "</pre>";
This should print out the list of variables that are passed through to the page you are on. But beware - remove this code again once you are done with it, because if you leave it on it leaves your site vulnerable to XSS attacks.
Hope this helps,
Stephen
Re: Help for module in component content
Hi Stephen,
thanks a lot for your quick answer.
I try this code with sef off but doesn't work:
Code:
if ($option == "com_tag" && $view == "item" ) {
/* (note: $option and $view are pre-populated -- any others you have to get manually like below ) */
$tag = JRequest::getVar("tag");
if ($tag == "libri") return 1; /* customise module id here */
}
is there a method to show a module when the component com_tag is active, when this com generate some content?
Thanks
Giovanni Alberto
Re: Help for module in component content
Can you send some URLs from your site (with SEF turned off), for some pages where you want the modules to appear, and some where they should not appear?
This will help to work out how to write the rule.
Cheers,
Stephen
Re: Help for module in component content
yes, that's the site:
http://joomla.portaparole.it/
and this is the url where i would like to show the module number id 1 (just the same of "RUBRICA"):
http://joomla.portaparole.it/index.php? … mp;lang=it
Now I turn off the joomla SEF but for the future it must be active...
thanks
Giovanni Alberto
Re: Help for module in component content
ok, how about:
Code:
if ($option == "com_tag" && JRequest::getVar("task") == "tag" ) {
$tag = JRequest::getVar("tag");
if ($tag == "libri") return 1;
}
That will target the module only onto the page that you gave the link for. It should work with SEF turned on as well.
Re: Help for module in component content
The problem is that you have the "menu assignment" set to "none" in the MetaMod - so it will never display!
You need to set the menu assignment to the page that you want it to appear on (or "all" pages should be ok, since the PHP rule will ensure it does not display on other pages).
The module that you want MetaMod to *include* needs to have "menu assignment" set to "none" though.
It's an easy mistake to make.
Hope that helps,
Stephen
Re: Help for module in component content
It's best to keep module 1 set to "menu assignment: none" so that it doesn't show up unless the MetaMod includes it.
Also, in your MetaMod I saw that you have the title set to display. Turn that OFF, otherwise the MetaMod title will always display, even if the MetaMod does not include module 1.
Make sense?
Cheers,
Stephen
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7634
- Newest User:
- boratuglu
- Members Online:
- 0
- Guests Online:
- 149
- 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