Page 1 of 1

[SOLVED] Upgrade to 1.11.4, ContentPreCompile not called

Posted: Mon Jan 14, 2013 3:07 pm
by dbuenzli
In my upgrade to 1.11.4, the event ContentPreCompile is never called on the content of my pages.

A little bit of logging indicates me that the code path for 'content' in this file is never taken on my content because the value of $smarty->_current_file is a kind of hash.

This problem was previously reported here. And is marked as fixed. But it doesn't appear to be on my side. Any ideas of what may have gone wrong ?

To be more precise I logged $smarty->_current_file, $result and $tpl_output of the afromentioned function. It appears at a certain point there is a $smarty->_current_file with value 'content:page_data' but at that moment the variable $tpl_output is empty:

Code: Select all

[14-Jan-2013 15:50:01 Europe/Zurich] ------------------------------------------------------------
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $smarty->_current_file: content:pagedata
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $result:
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $tpl_output:
The actual page content is called later with a hash-like $smarty->_current_file which means that the ContentPreCompile event is not generated.

Code: Select all

[14-Jan-2013 15:50:01 Europe/Zurich] ------------------------------------------------------------
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $smarty->_current_file: 3a4988ec627d8eba5ff304975c8687ef94bfff35
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $result:
[14-Jan-2013 15:50:01 Europe/Zurich] Precompile $tpl_output:Livre polyvalent [...]
N.B. This is in a context where WYSIWYG is globally disabled I tried with both {content} and {content wysiwyg='false'} in the template.

Thanks in advance for any help.

Re: Upgrade to 1.11.4, ContentPreCompile not called with con

Posted: Mon Jan 14, 2013 7:47 pm
by dbuenzli
I tried on a fresh 1.11.4 install. The same problem occurs. The content of the page has a hash in $smarty->_current_file and thus doesn't generate a ContentPreCompile event in this code.

Is that a deprecated way of doing things or is it a bug ? I need to be able to distinguish between compilation of a template and compilation of content.

Here the logging code and the output log whenever the page content is compiled.

Code: Select all

function smarty_prefilter_precompilefunc($tpl_output, &$template)
{
  $smarty = $template->smarty;
        $result = explode(':', $smarty->_current_file);

  error_log('---------------------------------------------------------');
  error_log('$smarty->_current_file:' . $smarty->_current_file);
  error_log('$result:' . print_r($result, true));
  error_log('$tpl_output:' . $tpl_output);

Code: Select all

[14-Jan-2013 19:36:09 UTC] ---------------------------------------------------------
[14-Jan-2013 19:36:09 UTC] $smarty->_current_file:1ca1860526cbff457f2ebbe8ee212a1e181f1dc4
[14-Jan-2013 19:36:09 UTC] $result:Array
(
    [0] => 1ca1860526cbff457f2ebbe8ee212a1e181f1dc4
)

[14-Jan-2013 19:36:09 UTC] $tpl_output:**Wiki** //markup// ! 

Re: Upgrade to 1.11.4, ContentPreCompile not called with con

Posted: Mon Jan 14, 2013 8:39 pm
by calguy1000
I fixed this this morning in svn... it will be released with 2.0 or if we do another release in the 1.11.x series.

Re: Upgrade to 1.11.4, ContentPreCompile not called with con

Posted: Mon Jan 14, 2013 9:07 pm
by dbuenzli
Thanks for the fix ! It works.

I was trying, at the moment, to understand what was happening in CMS_Content_Block but I wasn't getting anywhere...

For those interested before the next release, the fix is easy to integrate, see the following link (as code, square brackets seems to confuse the forum software):

Code: Select all

http://viewsvn.cmsmadesimple.org/comp.php?repname=cmsmadesimple&compare[]=%2Ftrunk@8635&compare[]=%2Ftrunk@8636