CMS Made Simple Forums
https://forum.cmsmadesimple.org/

[Fixed]$smarty->_current_file
https://forum.cmsmadesimple.org/viewtopic.php?f=80&t=62105
Page 1 of 1

Author:  Jean le Chauve [ Wed Jul 25, 2012 7:29 pm ]
Post subject:  [Fixed]$smarty->_current_file

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:
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;
}
?>

Author:  calguy1000 [ Wed Jul 25, 2012 9:02 pm ]
Post subject:  Re: $smarty->_current_file

gach, okay I'll look into it.

Author:  calguy1000 [ Thu Jul 26, 2012 3:14 pm ]
Post subject:  Re: $smarty->_current_file

Fixed in svn.

Author:  Jean le Chauve [ Thu Jul 26, 2012 3:15 pm ]
Post subject:  Re: $smarty->_current_file

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

Author:  calguy1000 [ Thu Jul 26, 2012 6:35 pm ]
Post subject:  Re: [Fixed but]$smarty->_current_file

evaluated templates are evaluated as strings... not much we can do about that.

Author:  Jean le Chauve [ Thu Jul 26, 2012 7:09 pm ]
Post subject:  Re: [Fixed but]$smarty->_current_file

Ok, Thank you for your answer.
This post is fixed.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/