Page 1 of 1

[Fixed]$smarty->_current_file

Posted: Wed Jul 25, 2012 7:29 pm
by Jean le Chauve
The value content:content_en in the variable $smarty->_current_file is now a string like d540fdf18880c4e881dd92fd9e7dc05ee28f9ea8
However, other values (globalcontent:***, content:pagedata...) still ok.

So, in the pre and post filters, the case "content" never happens.

Code: Select all

function smarty_prefilter_precompilefunc($tpl_output, &$template)
{
  $smarty = $template->smarty;
	$result = explode(':', $smarty->_current_file);
	if (count($result) > 1)
	{
	  if( startswith($result[0],'tmp_') ) $result[0] = 'template';

		switch ($result[0])
		{
		case 'stylesheet':
		  Events::SendEvent('Core','StylesheetPreCompile',array('stylesheet'=>&$tpl_output));
		  break;

			case "content":
				Events::SendEvent('Core', 'ContentPreCompile', array('content' => &$tpl_output));
				break;

		case 'tpl_top':
		case 'tpl_body':
		case 'tpl_head':
		case "template":
		  Events::SendEvent('Core', 'TemplatePreCompile', array('template' => &$tpl_output,'type'=>$result[0]));
		  break;

			case "globalcontent":
				Events::SendEvent('Core', 'GlobalContentPreCompile', array('global_content' => &$tpl_output));
				break;
			default:
				break;
		}

	}

	Events::SendEvent('Core', 'SmartyPreCompile', array('content' => &$tpl_output));

	return $tpl_output;
}
?>

Re: $smarty->_current_file

Posted: Wed Jul 25, 2012 9:02 pm
by calguy1000
gach, okay I'll look into it.

Re: $smarty->_current_file

Posted: Thu Jul 26, 2012 3:14 pm
by calguy1000
Fixed in svn.

Re: $smarty->_current_file

Posted: Thu Jul 26, 2012 3:15 pm
by Jean le Chauve
Great :)
Thank you

Sorry, if it's fixed for content_en, it still an other problem : evaluated template have the same bug ; it's value is a string like 49827e17aaeb246267be171d8e993eb407af77bf

Re: [Fixed but]$smarty->_current_file

Posted: Thu Jul 26, 2012 6:35 pm
by calguy1000
evaluated templates are evaluated as strings... not much we can do about that.

Re: [Fixed but]$smarty->_current_file

Posted: Thu Jul 26, 2012 7:09 pm
by Jean le Chauve
Ok, Thank you for your answer.
This post is fixed.