calls to the ContentData function in 0.11.2
Posted: Sat Jan 14, 2006 2:56 pm
I am almost sure that what I describe below is a bug in the stable release 0.11.2.
visible effects of the bug:
If a module uses the ContentData function in a nontrivial way (making any changes to the parameter of the function) the results of the changes are visible if you press the "Preview" button in the "Edit Content" area, but they are not visible if you press the "View Site" button in the menu (or just view your site in a browser).
The bug:
The 491 line of the content.functions.php file is:
and should (probably) be:
i.e. the parameter to the ContentData function should be $tpl_source instead of $content.
Explanation:
The function ContentData (in the line 491) is called inside the definition of the function:
Inside this definition the $content variable or parameter is not defined in any way. It is not a parameter to the content_get_template function and it is not defined or initialized inside the content_get_template function. So it is just a local variable, not used before or after the call to ContentData. Effectively the call to ContentData does nothing.
After fixing the probably-bug:
My problems with implementing a module filtering the content of a page are gone. Now everything works fine.
Marek
visible effects of the bug:
If a module uses the ContentData function in a nontrivial way (making any changes to the parameter of the function) the results of the changes are visible if you press the "Preview" button in the "Edit Content" area, but they are not visible if you press the "View Site" button in the menu (or just view your site in a browser).
The bug:
The 491 line of the content.functions.php file is:
Code: Select all
$gCms->modules[$key]['object']->ContentData($content);
Code: Select all
$gCms->modules[$key]['object']->ContentData($tpl_source);
Explanation:
The function ContentData (in the line 491) is called inside the definition of the function:
Code: Select all
content_get_template($tpl_name, &$tpl_source, &$smarty_obj)
After fixing the probably-bug:
My problems with implementing a module filtering the content of a page are gone. Now everything works fine.
Marek