I’ve started a discussion with Paul here: http://ellislab.com/forums/viewreply/278744/ about parsing plugins inside a weblog entries tag. The problem is that I’m using a plugin to return ‘related’ entries and to simplify things, I’d like to be able to call {title} from within my plugin and not have it parsed by the entries tag.
That said, does any one know of a way to get to a plugins variables before the parent entries tag parses? Would an extension do the trick? One interesting thing Paul mentioned would be to use a plugin and an extension of the same name, then inside the weblog entries tag my extension could run and replace out the variables before the entries tag ran, then outside the extension the normal plugin would run.
Finally, if this is all greek, a simple poll should make it a little more fun: if you were using a plugin which variables would make the most sense/be the easiest to remember and understand?
::looks at shirt, checks for Paul name-tag:: 😛
The issue I would have with making variables with the same name not parsed by the parent entries tag is that you are assuming that the user will not want the weblog entries’ tags variables to go there. This is why I think prefixed is the most clear–even someone unfamiliar with your plugin would be able to immediately tell what was going to be parsed by what. Consider:
{exp:weblog:entries}
<ul>
{exp:plugin}<li class="{class_field}"><a href="#" class="{class_field}">{title}</li>{/exp:plugin}
</ul>
{/exp:weblog:entries}
{class_field} is in the weblog entry and the entries that your plugin will output information from. But the user wants the first one controlled by the weblog entries tag, and the second one in the link by the entries in the plugin output. Isn’t this more clear, and easier to read, troubleshoot, and use?
{exp:weblog:entries}
<ul>
{exp:plugin}<li class="{class_field}"><a href="#" class="{pi_class_field}">{pi_title}</li>{/exp:plugin}
</ul>
{/exp:weblog:entries}
haha, sorry derek. all those signatures are blending together on me.
it’s surprising the response so far, I would have thought that [title] would be the preferred solution. I’m glad I asked though, i’ll start using it the other way. Your reasoning is sound and i think for future proofing it makes the most sense, especially because that way you could nest plugins in plugins and everything should still be peachy…..
thanks again for the thoughts everyone
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.