Bonjour
J'ai fait l'intégration du bout de code proposé par Arômes & Gourmandiz dans ce sujet
http://www.prestashop.com/forums/top...-de-recherche/
Il nous propose ce code afin de faire apparaître le message "Rechercher..." dans le champ de recherche, ce que je trouve très bien .
Une chose que j'aimerai ajouter c'est la traduction dans les différentes langues que mon site utilisera, (FR, GB, ES) le mot "Rechercher..." qui apparait dans le champ du moteur de recherche afin.
Comme les langues on un id différents comme suit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{else}{l s='Rechercher...' mod='blocksearch'}{/if}" onfocus="if(this.value=='{l s='Rechercher...' mod='blocksearch'}')this.value='';" onblur="if(this.value=='')this.value='{l s='Rechercher...' mod='blocksearch'}';" />
FR = id_lang=1
GB = id_lang=4
ES = id_lang=3
Je pourrai faire la condition suivante :
Mais vue que l'on ne mélange pas le code php et HTML sous prestashop à cause du MVC, je ne sais pas comment réaliser cette condition et afficher la bonne traduction du mot dans la langue....
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 if ( id_lang == 1 ) { echo "Rechercher..." ; } elseif (id_lang == 4 ) { echo "Search..." ; } else { echo "búsqueda" ; }
J'ai essayé ce code
Il provoque les erreurs suivantes
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{else}{ if ( id_lang == 1 ) { echo '{l s='Rechercher...' mod='blocksearch'}{/if}" onfocus="if(this.value=='{l s='Rechercher...' mod='blocksearch'}')this.value='';" onblur="if(this.value=='')this.value='{l s='Rechercher...' mod='blocksearch'}';" '; } else if ( id_lang == 4 ) { echo '{l s='Searsh...' mod='blocksearch'}{/if}" onfocus="if(this.value=='{l s='Search...' mod='blocksearch'}')this.value='';" onblur="if(this.value=='')this.value='{l s='Seach...' mod='blocksearch'}';" '; } else if ( id_lang == 3 ) { echo '{l s='büsqueda...' mod='blocksearch'}{/if}" onfocus="if(this.value=='{l s='büsqueda...' mod='blocksearch'}')this.value='';" onblur="if(this.value=='')this.value='{l s='büsqueda...' mod='blocksearch'}';" '; } } />
Merci de votre aide !!Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "
D:\mon-site\themes\theme782\modules\blocksearch\blocksearch-top.tpl"
on line 62 "echo '{l s='b&uuml;squeda...' mod='blocksearch'}{/if}"
onfocus="if(this.value=='{l s='b&uuml;squeda...' mod='blocksearch'}')this.value='';"
onblur="if(this.value=='')this.value='{l s='b&uuml;squeda...' mod='blocksearch'}';" ';
" unexpected closing tag' in D:\mon-site\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 667
SmartyCompilerException: Syntax Error in template "
D:\mon-site\themes\theme782\modules\blocksearch\blocksearch-top.tpl"
on line 62 "echo '{l s='b&uuml;squeda...' mod='blocksearch'}{/if}"
onfocus="if(this.value=='{l s='b&uuml;squeda...' mod='blocksearch'}')this.value='';"
onblur="if(this.value=='')this.value='{l s='b&uuml;squeda...' mod='blocksearch'}';" ';
" unexpected closing tag in D:\mon-site\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 667
Partager