1

Is there a way to access an embedded template variable with PHP? I thought maybe it'd be in the $_GET or $_POST var, but no such luck.

2 Answers 2

3

The array of embed_vars can be accessed this way on EECMS 2.5.5-:

$this->EE->TMPL->embed_vars

And this way on EECMS 2.6+:

ee()->TMPL->embed_vars

Use "embed:var_name" as the array key.

0

Can you give more description on what you are trying to accomplish?

My immediate guess from what you have told us would be to use something like Stash and create a global variable then parse your php after EE to allow the variable you need to be available for php parsing.

1
  • 1
    I've got say: {embed="temp_dir/temp" var="newVar"} and in temp_dir/temp I have no EE, only PHP. With EE tags, I'd simply call {embed:newVar} and get the embedded data I passed. In saying that I think I answered my own question. I could flip parse order and store the embedded var as a PHP var. $newVar = '{embed:newVar}';
    – Ryan Shrum
    May 2, 2013 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.