Thursday 07 August 2008 3:06:01 pm
I'm in in the process of cleansing some ezp3.9.x sites which have deprecated code strewn throughout, so I thought I'd throw some examples up for anyone who is starting to do the same in order to upgrade to ezp4.x. The main deprecated functions are:
{section}
{let}
{default}
<i>Section</i> is simple to replace, using <i>if</i> and <i>foreach</i>, e.g:
{section show=ne($classification|trim,"")} class="{$classification|wash}"{/section}
becomes
{if ne($classification|trim,"")} class="{$classification|wash}"{/if}
{section loop = ezini( 'StylesheetSettings', 'EditorCSSFileList', 'design.ini' )}
EditorCSSFileList[{$index}] = {$:item|ezdesign};
{/section}
becomes
{foreach ezini( 'StylesheetSettings', 'EditorCSSFileList', 'design.ini' ) as $index => $item }
EditorCSSFileList[{$index}] = {$item|ezdesign};
{/foreach}
<i>Let</i> can be replaced with <i>def</i> and <i>undef</i>:
{let attribute=$node.object.data_map.downloadable_file}
blah blah blah
{/let}
becomes
{def $attribute=$node.object.data_map.downloadable_file}
blah blah blah
{undef $attribute}
<i>Default</i> can be replaced with a condition and a def statement:
{default a=5}
becomes
{if is_unset( $a )}
{def $a=5}
{/if}
For <i>default</i> code with namespaces, use <i>def</i> and <i>set</i> as mentioned in the comments at http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_functions/variables/set Hope this is useful.
|