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.

 

Loading two module positions from one Metamodule

Loading two module positions from one Metamodule

I have two module positions one holds an image and one holds some text. The text discribes the image (special offers etc) and overlays the image via css. I don't want the text to be in the image file and needs to be changed by the user.

I would like to randomly display the image but also the matching text module to go with it.

Could anyone suggest a way to do this please?

So say if module no 7 is loaded module no 24 is loaded too in user1 and user2 ?

Edited By: uglykidjoe
08-Oct-12 21:54:25

uglykidjoe
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

ok, I think it's going to be easy enough to put the logic into the 1st MetaMod, then put the corresponding module id into a global variable to pick up in the 2nd module position.

So in the 1st module position, something like this:

$r = mt_rand(0, 5);
$images = array(33, 34, 35, 36, 37, 38); // 5 image modules
$text = array(101, 102, 103, 104, 105); // 5 text modules corresponding to image modules
global $metamod_text;
$metamod_text = $text[$r]; // used in other module
return $images[$r]; // for this module position, show image


Then in the 2nd module position (or just 2nd MetaMod):

global $metamod_text;
return $metamod_text; // for this module position, show text from other MetaMod


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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

Thanks very much
That works 99.99999% of the time sometimes nothing loaded.

$images = array(33, 34, 35, 36, 37, 38); // 5 image modules

Can I ssume that this is a typo as there are 5 X 2 modules

uglykidjoe
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

Think I cured it set the random range between 0-4 ie 5 'array positions'

uglykidjoe
Beginner Modder
ranks
useravatar
Offline
13 Posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

d'uh! Yes, of course it should have been mt_rand(0, 4) meaning 5 possible images and text. Sorry for putting you wrong there.

Best regards,
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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

I've searched for this question but I don't know if I've phrased it correctly. I'm working on a Joomla website and on one of the pages I have three module positions content-top-a content-top-b content-top-c So essentially the page width is divided into thirds.

urls deleted by admin

DarrellSBaggett
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Loading two module positions from one Metamodule

and your question is...  ???

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
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1689
Total Polls:
6
Total Posts:
5941
Posts this week:
1
User Info:
 
Total Users:
5349
Newest User:
tony55549
Members Online:
0
Guests Online:
120

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