Problem with preprocessed content withing block functions
| From: | Manuel Polo | Date: | Tue, 11 Feb 2003 13:26:32 +0000 |
| Subject: | Problem with preprocessed content withing block functions | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-676@lists.php.net to get a copy of this message | ||
Hi!
I'd like to take control for content inside a block function to be or
not be preprocessed by smarty, at least be reachable somehow.
The problem is in a recursive tree block rendering a tree menu:
function smarty_block_pxcms_tree($params, $content, &$this)
{
if($content == null) {
return true;
}
extract($params);
$str_result = "";
if(empty($str_node_var)) //Node var name
$str_node_var = "node";
if(is_array($array)){
$str_result = _gen_tree(&$array,$content,$str_node_var,$this);
}
return $str_result;
}
class MySmartyPlus extends Smarty {
function getValue($str_tpl,$str_msg = "DB content"){
if(empty($str_tpl))
return null;
$this->_compile_template($str_msg,$str_plantilla,$tp_source);
ob_start();
eval('?>' . $tp_source);
$str_out = ob_get_contents();
ob_end_clean();
return $str_out;
}
}
And the Template usage:
{pxcms_tree var="menu" array=$navigation_menu}
Menu: <br/>
{* I need this section to be not rendered by smarty withing the block
function because i will by using $this->getValue($content) *}
{section name=m loop=$menu}
{$menu[m].name}<br/>
{/section}
{/pxcms_tree}
Any suggestions? (I know ugly workarounds but i'd like more elegant
approaches ;) )
Manuel Polo Tolón
Dpto. I+D
Servicios de Telefon_Avanzada
Juan De la Cierva #23
50014 Zaragoza
Tlf. +034 902 11 12 21
correo-e: manuel.polo@sertelav.com
___________________________________________________________________________ _ _
/ La informaci_ncluida en el presente correo electr_o es CONFIDENCIAL,
| siendo para el uso exclusivo del destinatario arriba mencionado. Si
usted
| lee este mensaje y no es el destinatario se_do, el empleado o el
agente
| responsable de entregar el mensaje al destinatario, o ha recibido esta
| comunicaci_or error, le informamos que est_otalmente prohibida
| cualquier divulgaci_distribuci_ reproducci_e esta comunicaci_y
| le rogamos que nos lo notifique, nos devuelva el mensaje original a la
| direcci_rriba mencionada y borre el mensaje.
| Gracias.
\___________________________________________________________________________ _ _