Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.



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?

Beginner Modder
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,

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

3330 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
Total Topics:
Total Polls:
Total Posts:
Posts this week:
User Info:
Total Users:
Newest User:
Members Online:
Guests Online:

There are no members online

Forum Legend:

 New Sticky