Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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

Buzz50
Mr
Beginner Modder
ranks
useravatar
Offline
16 Posts
User info in posts
Administrator has disabled public posting

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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Total Posts Today:
1
User Info:
 
Total Users:
10075
Newest User:
rsker57
Members Online:
0
Guests Online:
151

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