Binders: meta

TODO:

 

/**
 * Smarty plugin: meta
 * Allow binding post or page metada to a template
 *
 * @param {array} $params 
 *            $params['post_id'] ID of the post or page
 *            $params['meta_key']
 *            $params['meta_value']
 *            $params['meta_single']
 *            $params['default']
 *            $params['type'] (optional) If is it set to 'object' it will return an object, otherwise it will return a JSON string.
 *            $params['assign_to'] Variable withing the template engine to which the content has to be assinged. 
 *
 * 
 * @example
 * 
 * # EXAMPLE 1 
 * {meta post_id="25" assign_to="my_meta"}
 * <p>My favorite color is {if $my_meta.data.color}$my_meta.data.color{else}UNKNOWN{/if}</p>
 * 
 * # EXAMPLE 2
 * {meta post_id="25" meta_key="color" assign_to="my_meta"}
 * <p>My favorite color is {if $my_meta.data.color}$my_meta.data.color{else}UNKNOWN{/if}</p>
 *
 * 
 * @see http://www.smarty.net/docs/en/plugins.functions.tpl
 *
 */

 

Leave a Reply

Your email address will not be published. Required fields are marked *