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
- » Show module in different positions
Show module in different positions
Show module in different positions
Is it possible to show a module in a specific position conditionally?
One example is this;
Show an Adsense module in the right column or the top position randomly so that the viewer does not get used to its location.
Head Buzzer
Buzz50 Seniors
Re: Show module in different positions
Mmm, great question.
You can do this with MetaMod Pro more easily than standard MetaMod. With the non-Pro version you have to have a MetaMod in each module position, and they have to communicate to decide which one is going to display the module, e.g. using a global variable. Then you have to know the order that the module positions get processed.
Anyway, with Pro it's easier, as you can dynamically modify the module position of the module. See http://www.metamodpro.com/metamod/contr … parameters for more info about the dynamic changes you can make to module parameters.
e.g. you can put the MetaMod in either one of the positions (or in any other random position), then do this:
// remember, this only works in MetaMod PRO!
$target=101; // module id of the module you want to re-position
$r = mt_rand(1,2);
if ($r == 1) $pos = "right";
else $pos = "top";
$changes->mod($target)->position($pos);
In this case you would need to ensure that the module is published and assigned to the correct pages already. This code simply changes the assigned module position.
Hope that helps,
Stephen
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Show module in different positions
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8028
- Newest User:
- musial8334
- Members Online:
- 0
- Guests Online:
- 121
- 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