Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Display different modules for each...
Display different modules for each Mosets Tree Listing
Display different modules for each Mosets Tree Listing
Hi,
I'm using the latest Joomla version (2.5.7) and the latest Mosets Tree version (2.2.6). I also downloaded the latest version of MetaMod. The url for the website is http://www.phuket-pocket-guide.com/
Under 'Phuket Hotspots' I'm using Mosets Tree to create listings of venues. I would like to display modules in the sidebar that are related to each venue.
I'm not a coder although I start to understand bits and pieces by trying to read as much info as possible and then just go for the trial and error. I found a few videos online about Metamod so I guess I understand the concept. The problem is that I have no idea how to write the PHP code to tell which module has to go on which listing. So my question is would it be possible to get me started with an example?
Thank you for your help,
Tony
Re: Display different modules for each Mosets Tree Listing
Hi Tony,
I think what you are saying is that you need to be able to identify particular Mosets entries by ID number, and allocate them a particular module in the sidebar.
That's pretty simple to achieve.
First, can you do me a favour: can you create a MetaMod, publish it, and set it to a valid module position, and assign it to ALL pages? Then inside the MetaMod, switch on Advanced Debug mode.
Then view the front end of your site and navigate to one of the product pages that you want to be able to identify. The MetaMod will display some PHP code. Copy and paste that PHP code into the forum here. Then I'll take a look at it and rewrite it for your particular situation. It won't be hard.
Cheers,
Stephen
Re: Display different modules for each Mosets Tree Listing
Hi Stephen,
thank you for the reply and the help.
Below is the code on one of the listing pages in Mosets Tree.
if (
$option == 'com_mtree'
and $Itemid == '167'
and JRequest::getVar('link_id') == '5' /*!*/
and JRequest::getVar('task') == 'viewlink' /*!*/
and JRequest::getVar('format') == 'html' /*!*/
) return XXX; /* replace XXX with the module ID or position to display */
Thank you very much.
Re: Display different modules for each Mosets Tree Listing
Ok, so it appears that each entry in Mosets is related to a "link_id". If you can get hold of these ids from inside Joomla then you should make a list of all the ids and the entries they relate to. Otherwise, use the MetaMod debug mode to give you this information about each of the products (and make that list).
Then you could use this code in a MetaMod that you put into the sidebar:
if (
$option == 'com_mtree'
and JRequest::getVar('task') == 'viewlink'
and JRequest::getVar('format') == 'html'
) {
switch (JRequest::getVar('link_id')) {
case 5: return AAA;
case 6: return BBB;
case 12: return CCC;
case 15: return DDD;
case 21: return EEE;
// Replace AAA-EEE with the module ids to use for each entry according to the id shown
// and of course customise the list above to suit your setup.
// Add more as appropriate
}
}
Now, don't forget to create and set up all the "target modules" that you want to display for these Mosets entries. You need to ensure that these are set to "none" menu items so that they do not show up until the MetaMod includes them.
See the Quick Start guide for more details on that: http://www.metamodpro.com/metamod/quick-start
Best regards,
Stephen
Re: Display different modules for each Mosets Tree Listing
Hi Stephen,
I tried a few pages and it works great. The only question I have now is that I need to change the margins (left and top)of the module. It seems all other modules have margins set like this 0px -15px -15px 0.
In which file would I be able to add/change the margin?
Thank you,
Tony
Re: Display different modules for each Mosets Tree Listing
Any different-to-usual margins are caused because there are the margins of the MetaMod module, and inside that the margins of the target module. There are some techniques for getting around that in the FAQs:
http://www.metamodpro.com/metamod/faq/2 … th-matamod
http://www.metamodpro.com/metamod/faq/2 … etamod-was
Hope those help,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Display different modules for each...
Board Info
- Board Stats:
- Total Topics:
- 1700
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 8056
- Newest User:
- no21an
- Members Online:
- 0
- Guests Online:
- 251
- 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