Upgrade smarty 2 to smarty 3/4


To find the file to be modified, see the red insert on the previous page:
"Important : Search for the template file to be modified"
Error : SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 63
line 63 shows:
<{block id=3}>
To correct this error, you have to change block to xoBlock.
<{xoBlock id=3}>
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 33
line 33 shows:
<{foreach item=category from=$category}>
To correct this error, you have to change the content of the variable item (here "category") so that it is not identical to the content of the variable from (also "category").
You can change the content of the variable item and put for example "itemcategory" instead of "category".
Be careful ! It will also be necessary to change all the variables contained in the loop "foreach" and which begins with "category" by "itemcategory".
<{foreach item=itemcategory from=$category}>
<{if $itemcategory.logo != ''}>
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 33
line 33 shows:
<{foreachq item=itemcategory from=$category}>
To correct this error, you have to change foreachq to foreach.
Don't forget to change the closing tag as well.
<{foreach item=itemcategory from=$category}>
<{/foreach}>
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 62
line 62 shows:
<{includeq file="$content_template"}>
To correct this error, change includeq to include.
<{include file="$content_template"}>
The elements below are all corrected in the same way, by adding quotes.
Example : success.png 'success.png'
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 2
line 2 shows:
<{xoAdminIcons success.png}>;
To correct this error, you must surround success.png with quotes: 'success.png'.
<{xoAdminIcons 'success.png'}>;
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 31
line 31 shows:
<{xoAppUrl user.php}>
To correct this error, you must surround user.php with quotes: 'user.php'.
<{xoAppUrl 'user.php'}>
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 51
line 51 shows:
<img src="/modules/xmtutorial/admin/<{xoModuleIcons16 edit.png}>" alt="<{$smarty.const._MA_XMNEWS_EDIT}>" />
To correct this error, you must surround edit.png with quotes: 'edit.png'.
<img src="/modules/xmtutorial/admin/<{xoModuleIcons16 'edit.png'}>" alt="<{$smarty.const._MA_XMNEWS_EDIT}>" />
Error: SmartyCompilerException: Syntax error in template "db:db:xmnewsadmincategory.tpl" on line 51
line 51 shows:
<img src="/modules/xmtutorial/admin/<{xoModuleIcons32 edit.png}>" alt="<{$smarty.const._MA_XMNEWS_EDIT}>" />
To correct this error, you must surround edit.png with quotes: 'edit.png'.
<img src="/modules/xmtutorial/admin/<{xoModuleIcons32 'edit.png'}>" alt="<{$smarty.const._MA_XMNEWS_EDIT}>" />
Variables with the same name
When the error message is similar to this one:
Error : SmartyCompilerException: Syntax error in template "db:db:xmnewsindex.tpl" on line 43 "<{foreach item=news from=$news}>" 'item' and 'from' may not have same variable name 'news'
you need to change the name of one of the loop's 'item' or 'from' variables in the template
Since smarty 3, it is no longer permitted to use the same name for these variables.
<{foreach item=news from=$news}>
Since smarty 3, vaibal names are different:
<{foreach item=itemnews from=$news}>
This problem mainly concerns module creators