[geeklog-devel] PLG_itemDisplay() hook in lib-story

Blaine Lang devel at portalparts.com
Wed Sep 30 07:18:23 EDT 2009


Dirk Haun wrote:
> Is there anything that PLG_itemDisplay does that could not be done using
> PLG_templateSetVars?
>
> I guess the main difference is that you wouldn't need to modify the
> story templates. But at the same time it would be more flexible, since
> that implementation of PLG_itemDisplay only added things to one specific
> template variable.
Agree and I've presently used PLG_templateSetVars butt was reviewing the 
code as I updated the plugins to see if I should not use PLG_itemDisplay.

The one thing that is missing with PLG_templateSetVars in this case is 
the item ID. The API PLG_itemDisplay does complete the present set of 
API's but it would be better if we also passed in the template object 
and leave it to the plugin function to set the template variables. 
Possibly the API function could support a boolean return or optional 
array. If the return from the API function is an array of type 
array(retcode => true, 'displayhtml' => $html) then that HTML is 
appended and layout position controlled by the calling code. Otherwise, 
the calling plugin API function can set what ever custom template vars 
and just return a boolean - this requires templates to be typically 
modified but can provide more flexibility.

Blaine





More information about the geeklog-devel mailing list