We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin Parsing in Weblog Entries

Development and Programming

Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

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?

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

::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}
       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

I’d agree with Derek. However, {pi_title} may not be perfect either, as there would be no clue to which plugin it belong. Perhaps {pluginname_title} or {pi_pluginname_title} would be even more meaningful?

-Markus

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

I think that’s what he means, Markus, that if the plugin were named, say “Relatedish Entries” that it would be {re_title}, etc.

       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

Great. So I casted my vote for my favorite version 😉

       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.