amaneuz Posted January 28, 2017 Posted January 28, 2017 Bonjour, J'ai inclus ce bout de code dans un fichier .tpl {literal} <script type="text/javascript"> $(function() { $( "#slider-range" ).slider({ range: true, min: {/literal}{$filter.mavariable}{literal}, max: 2000, values: [ 200, 1200 ], slide: function( event, ui ) { $( "#amount" ).html( ui.values[ 0 ] + " € - " + ui.values[ 1 ]+ " € " ); $( "#amount1" ).val(ui.values[ 0 ]); $( "#amount2" ).val(ui.values[ 1 ]); } }); $( "#amount" ).html( $( "#slider-range" ).slider( "values", 0 ) + " € - " + $( "#slider-range" ).slider( "values", 1 ) + " € " ); }); </script> {/literal} et j'ai droit à ce message d'erreur dans le debugger : 1/1 ContextErrorException in smarty_internal_templatebase.php(171) : eval()'d code line 63: Notice: Undefined index: filter Merci de votre aide ! Share this post Link to post Share on other sites More sharing options...
coeos.pro Posted January 28, 2017 Posted January 28, 2017 ça veut dire que $filter n'existe pas Share this post Link to post Share on other sites More sharing options...
amaneuz Posted January 31, 2017 Posted January 31, 2017 oui mais quand je l'insère dans {foreach form=filter item=filter}, ça m'affiche l'erreur Notice: Undefined index: mavariable alors que quand je fais juste {filter.mavariable}, ça m'affiche bien le contenu de mavariable Share this post Link to post Share on other sites More sharing options...
Matt K. Posted January 31, 2017 Posted January 31, 2017 Bonjour, $filter est un tableau ? Tu as vraiment besoin de le mettre dans un foreach ? Share this post Link to post Share on other sites More sharing options...
coeos.pro Posted January 31, 2017 Posted January 31, 2017 oui mais quand je l'insère dans {foreach form=filter item=filter}, ça m'affiche l'erreur Notice: Undefined index: mavariable alors que quand je fais juste {filter.mavariable}, ça m'affiche bien le contenu de mavariable 1- ce n'est pas form mais from 2- http://www.smarty.net/docsv2/fr/language.function.foreach.tpl si tu mets le même nom pour from et item, il ne faut pas s'étonner d'avoir des erreurs Share this post Link to post Share on other sites More sharing options...
GT ITECH Posted February 26, 2017 Posted February 26, 2017 oui mais quand je l'insère dans {foreach form=filter item=filter}, ça m'affiche l'erreur Notice: Undefined index: mavariable alors que quand je fais juste {filter.mavariable}, ça m'affiche bien le contenu de mavariable Si en faisant {filter.mavariable} cela marcherait et t'afficherait ta variable, ton code javascript fonctionnerait vu que c'est exactement ce que tu utilise dedans.... Share this post Link to post Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now