开发者

Pass channel entry data to plugin in Expression Engine 2

Passing variables to EE Plugins is pretty straightforward. Problem is, for plugins with more advanced logic, I need upwards of four or five pieces of data from a channel entry. Hard to guarantee that it'll be entered correctly every 开发者_开发知识库time.

The alternative I guess is asking for the entry ID and querying for it, but that's kind of redundant, because it's already being queried for, and I'm in a loop, so I'd be adding 10-15 queries per page for data I already have available.

So, inside the {exp:channel:entries} loop, how can I pass the data contained in the current entry to a plugin function?

Thanks


There's no magic answer here Dennis. Just collect the entry data using plugin parameters. If you're worried about missing required parameters, just make sure you check to make sure they've all been passed-in first before trying to perform your plugin logic.

You can return an error message if you like when required params are missing, or use $this->EE->TMPL->log_item(); to show an error message only via the Output Profiler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜