* {meta_tag type='' method=''}CONTENT GOES HERE{/meta_tag} * * * Requires parameters 'type' and 'method' * to function. * * Parameter 'type' must be one of the following: * * title, description, keywords, author * * Parameter 'method' must be one of the following: * * add, replace * * Setting the 'type' parameter updates the corresponding * meta data. The 'method' parameter dictates whether * existing meta data should be added to or replaced. * * Example: * * * {meta_tag type='title' action='replace'}Hello world!{/meta_tag} * {meta_tag type='description' action='add'}head,shoulders,knees,toes{/meta_tag} * * * The above example REPLACES the current page title with the text "Hello World!" * and ADDS "head,shoulders,knees,toes" to the keywords. * * @author Milan Hawkins * @copyright Include - http://www.include-digital.com * @link http://blog.include-digital.com/2009/04/03/smarty-seo-plugin-meta_tag * @version 1.0.1 * @param array $params Array of parameters * @param string Contents of the block * @param Smarty Smarty instance * @return string $content Information contained within {meta_tag}{/meta_tag} re-formatted for use by the meta_tag output filter */ function smarty_block_meta_tag($params, $content, &$smarty) { if (is_null($content)) { return; } // normalize content $content = trim(strip_tags($content)); // check for valid params foreach ($params as $_key => $_val) { switch (strtolower($_key)) { case 'type': case 'method': $$_key = (string)$_val; break; default: $smarty->trigger_error("meta_tag: unknown attribute '$_key'"); } } // check type switch (strtolower($type)) { case 'title': case 'description': case 'keywords': case 'author': // output tags to screen for parsing by outputfilter $content = "".$content."\r\n"; break; default: $smarty->trigger_error("meta_tag: unknown type '$type'"); } return $content; } ?>