Thanks a lot man !! It worked perfecly !!

 






> Im using smarty template engine .. Id like to know if theres a way to 
> place php functions, specifically nl2br(), into smarty templates .. 
> Not in php script that calls smarty class.

Take a look at the modules/ folder in Smarty. You can create your own
modifier to use in your templates.

You'd want to make a file called modifier.nl2br.php

and have it's contents something like this:

<?php

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     modifier
 * Name:     nl2br
 * Purpose:  add <br /> to all newlines in string
 * -------------------------------------------------------------
 */
function smarty_modifier_nl2br($string)
{
    return nl2br($string);
}

?>

and then you'd display your value like {$value|nl2br} in the templates.

You could just use the nl2br() function in your assign(), too:

$smarty->assign('text',nl2br($text));

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to