I have got stuck while building a new module at the template tag point. I want to achieve something similar to this:
<ul>
{exp:module:method1}
<li id="Handle{entry_id}">
<ul class="subentries">
{exp:module:method2 entry_id="{entry_id}"}
<li>
<h2>{title}</h2>
{other_data}
</li>
{/exp:module:method2}
</ul>
</li>
{/exp:module:method1}
</ul>I have followed the instructions on the module tutorial located here: http://ellislab.com/expressionengine/user-guide/development/module_tutorial.html
My code is similar to the following:
public function method1() {
//Do database query to fill up the $variables var
$output = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables);
return $output;
}
public function method2() {
if (($entry_id = $this->EE->TMPL->fetch_param('entry_id')) === FALSE) return;
//Do database query to fill up the $variables var
$output = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables);
return $output;
}However when this runs the second method only gets passed pure HTML in the $this->EE->TMPL->tagdata var, all of the tags have already been parsed out. Is there a way round this or is ExpresionEngine restricted to only supporting custom template tags one level deep?
Thanks Barney
I can alter the names of the tags easily enough, although the ExpressionEngine native ones don’t seem to have this problem. The main problem i have so far is that the second method isn’t being passed any tags at all. When it runs it receives HTML with no tags in it. E.g:
<li>
<h2></h2>
</li>So there is nothing for it to parse and insert tags in.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.