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.

 

How to fire a click event to a MetaMod module from an article!!!!

How to fire a click event to a MetaMod module from an article!!!!

Hi there, Im new on this and I have this issue since 2 weeks ago!!
I´d higly appreciate any help!

I have this metamod module that I´d like to fire a click event on it when someone
click´s on a link/botton inside one of my articles.

In this way metamod can decide where to redirect the user.

Any ideas how to implement this?

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

Re: How to fire a click event to a MetaMod module from an article!!!!

mmm, good question. You want to be able to use logic in MetaMod, but you want to trigger this from an arbitrary onClick event from elsewhere on your page.

One easy way to do this would be to make a fixed page URL that will be your target URL. Otherwise the JS is a little more complicated because it has to calculate the current page URL, and deal with GET/POST differences etc.

So, create a dummy page somewhere by creating a dummy article and putting a link to it from a hidden menu item, then give it the URL "http://example.com/redir". Make sure the MetaMod is assigned to that page.

Then add some JS to your page to attach an "onClick" event to some links or images or whatever.

The onClick event should cause a hyperlink to /redir?do=SOMETHING

Then in your MetaMod you can do this:

$do = JRequest::getVar("do");
if ( $do == "SOMETHING") {
  // .... some code to do a redirection
} else if ($do == "SOMETHING_ELSE") {
  // do something else
}
else {
  // do a redirection here. You need this backstop.
}


Hope that's what you're after,
Cheers,
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
Posts this week:
1
User Info:
 
Total Users:
10118
Newest User:
jack67484
Members Online:
2
Guests Online:
140


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked