pasta.pesto Posted July 16, 2010 Share Posted July 16, 2010 Bonjour,j'ai actuellement un diaporama qui fait défiler l'image de couverture de chaque produit en page d'accueil.je souhaiterait choisir l'image que je veux afficher dans ce diapo (celle en position N°2 je m'arrangerais pour mettre la couverture en position n°1 à chaque fois) mais comment faire ? style="background-image:url('{$img_prod_dir}{$product.id_image}-diapo.jpg'); display:block; height:350px;" Comment assigner à la variable {$product.id_image} l'image en position N°2 via une requête SQL en PHP ? on peut toucher à la base SQL avec smarty ect .... ?Merci Link to comment Share on other sites More sharing options...
pasta.pesto Posted July 20, 2010 Author Share Posted July 20, 2010 UPJe vais utiliser du PHP pour faire une requête mais 1ère question j'aimerais récupérer la variable smarty du numéro de produit en php :{php}$myVar = $smarty->get_template_vars('img_prod_dir');echo $myVar;{/php}comment faire ?merci Link to comment Share on other sites More sharing options...
pasta.pesto Posted July 20, 2010 Author Share Posted July 20, 2010 Bon je viens de bricoler un truc c'est pas jolie mais ça marche : {php} $myVar = $this->get_template_vars('product'); $a = $myVar["id_product"]; $b = mysql_query("SELECT * FROM ps_image WHERE id_product='$a' AND position=2"); $c = mysql_fetch_array($; $d = $c['id_image']; {/php} J'ai plus qu'a mettre $d dans l'url de l'image et c'est bon ! Link to comment Share on other sites More sharing options...
fherrard Posted March 23, 2011 Share Posted March 23, 2011 bonjour j'ai essayé ce code dans productlist mais aucune variable ce genere normal? Link to comment 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