Adding Coolfilter tags to link in contemplate..

kakoolcom - January 5, 2008 - 23:53

We have an evid ["embedded video"] node type. Users can submit title, etc + a link like:
http://youtube.com/?v=p8737NidnkU

Coolfilter looks for tags like this:
[coolplayer]http://youtube.com/?v=p8737NidnkU[/coolplayer]

We tried to add them to the evid template :

$fixstring = $node->content['body']['#value'];
$linkpos = strpos($fixstring,'http');
$linkpos2 = strpos($fixstring,' ', $linkpos);
$fixstring = substr_replace($fixstring, "[/coolplayer]",$linkpos2);
$oldurl = substr($fixstring, $linkpos,$linkpos2-$linkpos);
$newurl = "[coolplayer]".$oldurl;

But contemplate won't let us (to prevent xss attacks I think)

Is there an easy way to do this?

The alternative (adding tags when saving the node) violates a cardinal principle: never change a user's raw data..

Any ideas??

 
 

Drupal is a registered trademark of Dries Buytaert.