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.

 

Not able to return template name and continue

Not able to return template name and continue

Hi again.

It´s been a while, hope you are well and enjoying yourself:)

I have a MT rule which queries my DB, sets some session variables and then returns the name of a template.

Unfortunately, I´m not able to have it continue to the next rule.
(Where I would like to do some further queries and set another session based on the results of the first)-Is it even possible to pass information between rules in this manner? -Can a rule read variables or session variables declared by the previous rule?

I know you should be able to append ':continue' to the template name, but doing so, the page gets a 404 error. Setting the success rule option to process the next rule does not seem to do much either.

The following rule loads PHP (require_once ....), might that cause an issue?

Also, might the code be too long?


Once MT has set a template, does the code for the page continue (components, modules) or does that happen once MT has gone through all of the rules?

I guess it would be help if I had a better understanding of the flow of things.

Hope you like questions:)smile

Have a nice day,

Julian

apollo123
Beginner Modder
ranks
useravatar
Offline
17 Posts
Administrator has disabled public posting

Re: Not able to return template name and continue

Hi Julian,

Yes, I like questions smile

I'm surprised that the :continue method didn't work for you. Can you try to isolate the problem a bit more by making a rule following that rule that doesn't do very much? (i.e. no require_once's, perhaps just force the template to something else or disable or something, just to flag that it worked).

Also, don't forget the MetaTemplate Debug mode - it's in the main preferences panel that you can get from the Rule Chain page. With Debug mode, MetaTemplate should spit out all the rules that it's attempting and give you some idea of where it got to.

There's no theoretical limit to the length of code in the PHP boxes. They are stored as a "text" record in MySQL which allows for very large amounts of text.

"require_once" should not be a problem as long as the file exists that you are trying to include, in which case it may throw an error.

To pass information between MetaTemplate rules, you could use global variables. e.g:

//In 1st rule:
global $my_results;
$my_results = "foo";

// then in the next rule:
global $my_results;
if ($my_results == "foo") return true;

About the flow of execution of MetaTemplate:
- if you return a template name for a rule *without* ":continue", none of the other rules are checked. The template is simply set, and MetaTemplate passes control back to Joomla to create the pages etc.
- if you return a template name for a rule *with* ":continue", the execution continues with the next rule in the chain. The SUCCEED and FAIL actions are *not* run for the original rule. [it was hard to know what the right thing to do was: should it be to run it as a succeed? Or a fail? I decided just to bypass those and continue with next rule]
- If you return a boolean true value, the SUCCEED action is run
- If you return a boolean false value, the FAIL action is run

I hope that answers those questions smile

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10727
Newest User:
solza2
Members Online:
0
Guests Online:
166

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