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

Passing an entire channel item to a plugin

Development and Programming

emarthinsen's avatar
emarthinsen
4 posts
15 years ago
emarthinsen's avatar emarthinsen

Hello-

I want to create a plugin where I can add a tag like this:

{exp:my_custom_tag}

Where the my_custom_tag plugin will look at the ENTIRE channel entry (custom fields and all) and then output some custom, conditional information.

How can my plugin gain access to the currently active channel item? Is it in the context somewhere?

Regards, Eric

       
Eric Barnes's avatar
Eric Barnes
487 posts
15 years ago
Eric Barnes's avatar Eric Barnes

I do not believe you can do it that way with out a lot of headache. Why don’t you just add the conditionals to the template file? Or am I missing something?

       
emarthinsen's avatar
emarthinsen
4 posts
15 years ago
emarthinsen's avatar emarthinsen

Nope, you aren’t missing something. It is possible to do the conditionals in the template file, but the specific conditionals that I want to do will be re-used in several different places, to I’m trying to encapsulate them for reuse and maintenance.

Is there a different way to go about this that might have fewer headaches?

Regards, Eric

       
Eric Barnes's avatar
Eric Barnes
487 posts
15 years ago
Eric Barnes's avatar Eric Barnes

Maybe look at snippets or template embeds. http://ellislab.com/expressionengine/user-guide/templates/globals/snippets.html http://ellislab.com/expressionengine/user-guide/templates/embedding_templates.html

       

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.