Dans Arfooo 1, pour avoir mes variables smarty dans un array PHP, je faisais ceci :
- Code: Tout sélectionner
$vars = $this->get_template_vars();
Marche plus avec arfooo 2 :'(
Quelqu'un aurait la solution ?
merci
$vars = $this->get_template_vars();
$vars = $this->_vars;
{* this template includes a {php} block that assign's the variable $varX *}
{php}
global $foo, $bar;
if($foo == $bar){
echo 'This will be sent to browser';
}
// assign a variable to Smarty
$this->assign('varX','Toffee');
{/php}
{* output the variable *}
<strong>{$varX}</strong> is my fav ice cream :-)
//ICI NOUS SOMMES EN SMARTY DANS UN FICHIER TPL, EN UTILISANT UNE VARIABLE $produit qui contient les information du produit en question (nom, id, prix, ect...)
{if isset($produits)}
{foreach from=$produits item=produit name=produits} //ON FAIT UNE BOUCLE POUR AFFICHER CHAQUE PRODUIT
<h2>Nom du produit: {$produit.nom}</h2>
<p>Produit numéro {$produit.id_produit|intval}</p>
{php}
$id_produit = $smarty->_produit.id_produit;// C'EST ICI QUE JE COINCE, CAR CECI N'AFFICHE PAS L'ID...
$id_produit = $smarty->_produit['id_produit'];// CA N'ONT PLUS CA NE FONCTIONNE PAS
{/php}
Retourner vers Installation, aide et report de bugs
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités