smarty function for a normalized meta tag keywords

i set up some product catalogues with the csv files from affili.net and i needed a function for smarty to create a nice looking keyword list for the meta tag. that's why i wrote this modifier function to use it directly in the templates:
Permalink to this Snippet
usage:
{$string|keywords} or {$array|keywords}

result:
"One of Smartys - primary - design goals is to facilitate the 'separation' of application (code) from presentation."
would become:
"application, separation, code, from, presentation, the, facilitate, smartys, primary, design, goals, one"
you can modify the "if( strlen( $val ) > 2 )" and set it to 3 to get rid of "the", "one" etc.

Activity

No comments, leave your comment or trackback.

Leave a Reply


Search

The archives run deep. Feel free to search older content using topic keywords.