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 is the PHP script in MetaMod actually triggered?

How is the PHP script in MetaMod actually triggered?

I am in the process of evaluating the use of MetaMod in a situation where an asynchronous trigger is required from say Module A (on completion of a task like the selection of a variable) to refresh Module B - that requires on a (changed) parameter from Module A. (I have no problem with passing the parameters between the two modules.)

In a nutshell, I am trying to understand how an event in the CMS triggers the execution of the PHP script?

Let me describe the simplified scenario I am trying to implement: I want to implement a master-detail relationship between Module A (Master view) and Module B (Detail view). When the user selects a row from Module A, I want Module B to be updated (or redisplayed/ refreshed) with field data, based on the selection of the row value in Module B. My plan, very simply) is to put Module A into a MetaMod wrapper, and to use a PHP script to invoke Module B (when a state change has taken place in Module A - say the user selection of a row value).

What I am unclear about is the relationship between a state change in Module A (i.e. the select of a row) the triggering of the execution of the PHP script in the MetaMod wrapper.

Any insight into this asynchronous triggering behaviour will be really appreciated!

Kind regards,

Alastair Walker

alastairwalker
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: How is the PHP script in MetaMod actually triggered?

Hi Alastair,

thanks for your question - it's a very good one. Let me explain a little how it works.

1 - remember the page cycle on the web. In basic cases, a page request is made which is picked up by the CMS via the web server. The CMS responds to this by creating the HTML code for the entire new page depending on the request and any other state retrieved from the database or web server.

2 - in Joomla, each page request like this generates the output from the main "component" on the page as well as generating the output from a list of "modules" that have been assigned to that page. All these are put together in the context of the "template" and then output back to the web browser. (that's the simplified version! the whole story involves plugins, overrides etc).

3 - MetaMod is a module, so it operates at the point in the PHP code where Joomla is evaluating the PHP code for that module on the page.

4 - in order for the user to manipulate something in a module and have that generate something different in a different module, this would traditionally involve a second complete page request. i.e. clicking on something in the module would perform a new page request with GET parameters or a POST request that indicated what the user had clicked on. In Joomla then, the component or modules could pick up that information and alter their HTML output accordingly.

5 - for more interactive modern sites, a complete page request for a master-detail relationship is just too inefficient, so generally these days it's done with AJAX requests. If this is the case, then it's probably not a job for MetaMod, which operates in response to a complete page request.

In order to use AJAX to asynchronously get data from Joomla you probably need to be creating a component or plugin that can respond to the AJAX requests, then design your modules in JavaScript that can deal with the data at a JS level.

Hope that makes sense,
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: How is the PHP script in MetaMod actually triggered?

Thank you for a very detailed response! You have given me a lot to think about.

Kind regards,

Alastair

alastairwalker
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5173
Newest User:
nycphoto22
Members Online:
2
Guests Online:
114


Forum Legend:

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