Jump to content

PROBLEME SCRIPTS


pakman

Recommended Posts

Bonjour à tous, je vous explique rapidement je souhaite intégré dans ma page header.tpl ce script

[removed]
   $(document).ready(function(){
       $('#photos').galleryView({
           panel_width: 800,
           panel_height: 300,
           frame_width: 100,
           frame_height: 100
       });
   });
[removed]



Je problème c'est que j'ai un bug smaty si joins

Fatal error: Smarty error: [in /home/caninlan/www/themes/prestashop/header.tpl line 56]: syntax error: unrecognized tag: $('#photos').galleryView({ panel_width: 800, panel_height: 300, frame_width: 100, frame_height: 100 (Smarty_Compiler.class.php, line 446) in /home/caninlan/www/tools/smarty/Smarty.class.php on line 1095



Pouvez-vous m'aider car je n'es pas d'expérience pour résoudre ce problème en vous remerciant d'avance.

Link to comment
Share on other sites

Bonjour,

Fait attention au mixage des templates smarty et le code javascript.

Dans ton tpl, pense à placer à chaque usage du javascript la balise literale qui annule le traitement syntaxique de smarty. Le cas se présente surtout avec l'usage des accolades { }.

un exemple de code :

{literal}
   $(document).ready(function(){
       $('#photos').galleryView({
           panel_width: 800,
           panel_height: 300,
           frame_width: 100,
           frame_height: 100
       });
   });
{/literal}



La limite de la balise {literal} {/literal} est que si tu souhaites faire intervenir du code à la volée dedans pense à fermer la balise et la ré-ouvrir, de cette manière :

{literal}
   $(document).ready(function(){
       $('#photos').galleryView({
           panel_width: {/literal} TRAITEMENT {literal},
           panel_height: {/literal} TRAITEMENT {literal},
           frame_width: {/literal} TRAITEMENT {literal},
           frame_height: {/literal} TRAITEMENT {literal}
       });
   });
{/literal}



Ca devrai t'aider ;)

A+

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...