|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Guilli Smarty n00b
Joined: 15 Jun 2011 Posts: 3
|
Posted: Wed Jun 15, 2011 8:39 am Post subject: Passage de smarty 2 à smarty 3 |
|
|
Bonjour,
Dans le cadre d'une boutique prestashop, suite à la migration de mon template de smarty 2 vers smarty 3 j’ai les problèmes suivants dans un fichier tpl:
Code: |
{include file=$tpl_dir./breadcrumb.tpl} |
me donne :
Quote: | Fatal error: Uncaught exception ‘SmartyCompilerException’ with message ‘Syntax Error in template “/web/maboutique/themes/prestashop/cms.tpl” on line 1 “{include file=$tpl_dir./breadcrumb.tpl}” – Unexpected “/”, expected one of: “{” , “$” , “identifier” , INTEGER’ in /web/maboutique/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php |
De plus dans mon tpl, j’avais un morceau de code en php (je sais pas bien) :
Code: | $this->assign('cmsPageCourante',$resultat); |
me donne :
Quote: | Fatal error: Using $this when not in object context in /web/maboutique/tools/smarty/plugins/block.php.php(23) : eval()‘d code on line 8 |
pouvez vous m’aider à resoudre ces problèmes, merci. |
|
Back to top |
|
Code62 Smarty Rookie
Joined: 21 Jun 2011 Posts: 12 Location: Work@Liège.be
|
Posted: Tue Jun 21, 2011 11:24 am Post subject: |
|
|
Salut,
Dans Smarty 3, le nom du fichier a inclure doit être entouré de quotes si il contient des caractères spéciaux:
Quote: | == Unquoted Strings ==
Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
so long as they contain no special characters. (anything outside of A-Za-z0-9_)
For example filename strings must be quoted:
<source lang="smarty">
{assign var=foo value=baz} <-- works ok
{include file="path/foo.tpl"} <-- needs quotes!
</source> |
( http://smarty-php.googlecode.com/svn/trunk/distribution/SMARTY2_BC_NOTES )
Ton code devrait donc à nouveau fonctionner si tu le remplaces par:
Code: | {include file="$tpl_dir./breadcrumb.tpl"} |
Pour le second problème, une assignation directe pourrait fonctionner (à tester):
Code: | {$cmsPageCourante = $resultat} |
|
|
Back to top |
|
Guilli Smarty n00b
Joined: 15 Jun 2011 Posts: 3
|
Posted: Tue Jun 21, 2011 12:18 pm Post subject: |
|
|
merci beaucoup pour ton aide. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|