Here is very easy code to create Tagged List with hyperlink.
I have found several events where we have to create dynamic URL with Tagged text.
I have used very simple approach. Just Exploded sting and replaced space with “-”
You can use PHP function preg_replace() or str_replace() then used here-docs for creating hyperlink.
Instead of Echo Hear Docs is much better solution.
And at last removed the last Comma, and return your comma separated Dynamic links.
$tags = "jQuery Tutorials, PHP Display Errors, Drupal Module";
$tagL="";
function b2b_article_LinkedTags($stringTags) {
$expTags = explode(",",$stringTags);
foreach($expTags as $key=>$Tagevalue) {
$Tagevalue = trim($Tagevalue);
$link = preg_replace('/[^-a-z0-9]/', '-', strtolower($Tagevalue) );
//$link = str_replace(" ","-", strtolower($Tagevalue));
$tagL.=<<$Tagevalue,
EOF;
}
return substr($tagL, 0, -1);
}
echo b2b_article_LinkedTags($tags)
Very good write-up. I definitely appreciate this website.
Keep it up!