Forum Moderators: coopster
so its a function that replace the content of an href
Can someone tells me if there are any exceptions where this code will not work? I really need to be sure of this one...
/*
*news is the news to tag
*code is the member unique code
*
*/
function tag_newsletter($news,$code){
$tag_link=variable_get('tag_link','http://www.example.com/tag.php?MyUrl=');
$tag_link=$tag_link.$code.'-';
$search= '@href=[\"\'](.*?)[\"\']@si';
$news=preg_replace_callback($search,create_function(
'$matches',
'return "href=\"".urlencode($matches[1])."\"";')
,$news);
return $news;
}
[edited by: dreamcatcher at 5:42 pm (utc) on Oct. 20, 2008]
[edit reason] use example.com. Thanks. [/edit]