Votre question

php dans javascript

Tags :
  • Javascript
  • Internet
Dernière réponse : dans Internet
19 Avril 2006 09:19:38

Bonjour,

jecherche a faire un menu dynamique en javascript pour ça c bon je me débrouille; le problème c'est que mes catégorie de mon menu sont dans ma base de données Mysql et j'aimerai utiliser du php pour appeler mes catégorie.

commen je peux faire car quand je met du php dans mon document .js mon menu n'apparait plus.

merci

Autres pages sur : php javascript

19 Avril 2006 10:40:21

change l'extension de ton fichier en .js.php (n'oublie pas de modifier la balise link).
Le php s'execute sur le serveur dans les fichiers .php.
ton fichier ne differera pas d'un .js classique, à part qu'à certains endroit du code de ton menu tu aura des balises php :

<?php echo ... ; ?>
19 Avril 2006 12:02:48

donc quand je veux appeler mon menu je fai un truc de ce genre

<script type="text/javascript" language="JavaScript1.2" src="stmenu.js.php"></script>

je remplace les link par quoi?
Contenus similaires
19 Avril 2006 12:11:11

laisse tomber pour le link, je croyais que tu liais ton fichier js dans l'en-tête avec la balise link, mais dans ton cas normallement ça marche avec ce que tu viens de montrer.
19 Avril 2006 12:18:47

une fois que g édité mon fichier .js.php ca donne ca

<?
include "connexion.inc";
?>


stm_bm(["menu6aef",640,"","blank.gif",0,"","",0,0,0,50,500,1,0,0,"","",0,0,1,1,"default","hand",""],this);
stm_bp("p0",[1,4,0,0,4,5,0,0,100,"progid:D XImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.25)",-2,"progid:D XImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.25)",-2,85,0,0,"#7F7F7F","transparent","",0,0,0,"#999999"]);
stm_ai("p0i0",[0,"Accueil","","",-1,-1,0,"#","_self","","","","tt2.gif",0,0,0,"","",0,0,0,0,0,"#f1bb00",0,"#4b0303",0,"","",3,3,1,2,"#4B0303","#f1bb00","#FFFFFF","#FFFFFF","bold 16px Comic Book Commando","bold 16px Comic Book Commando",0,0]);
stm_aix("p0i1","p0i0",[0,"Series","","",-1,-1,0,"#","_self","","","","tt2.gif",0,0,0,"","",0,0,0,0,0,"#f1bb00",0,"#4b0303",0,"","",3,3,1,2,"#4B0303","#f1bb00","#FFFFFF","#FFFFFF","bold 16px Comic Book Commando","16px Comic Book Commando"]);
stm_bp("p1",[1,2,0,0,2,5,5,7,100,"progid:D XImageTransform.Microsoft.Stretch(stretchStyle=hide,enabled=0,Duration=0.10)",-2,"progid:D XImageTransform.Microsoft.Stretch(stretchStyle=hide,enabled=0,Duration=0.10)",-2,100,0,0,"#000000","transparent","",3,0,0,"#333333"]);


<?php
$Rs=mysql_query("SELECT * FROM categorie");
while($Tab = mysql_fetch_array($Rs))
{
?>


stm_aix("p1i0","p0i0",[0,"<?php echo $Tab["nom_cat"]; ?>","","",-1,-1,0,"#","_self","","","","",5,4,0,"","",7,6,0,0,1,"#f1bb00",0,"#4b0303",0,"","",3,3,1,2,"#4B0303","#f1bb00","#FFFFFF","#FFFFFF","bold 14px Comic Book Commando","bold 14px Comic Book Commando"]);
stm_bpx("p2","p1",[1,2,0,0,4,5,5,0,100,"progid:D XImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.25)",-2,"progid:D XImageTransform.Microsoft.Fade(overlap=.5,enabled=0,Duration=0.25)",-2,85,0,0,"#7F7F7F"]);


<?}?>


<?php
$Rs=mysql_query("SELECT * FROM comics");
while($Tab = mysql_fetch_array($Rs))
{
?>


stm_aix("p2i0","p0i0",[0,"<?php echo $Tab["nom_co"]; ?>","","",-1,-1,0,"#","_self","","","","",5,4,0,"","",0,0,0,0,1,"#f1bb00",0,"#4b0303",0,"","",3,3,1,2,"#4B0303","#f1bb00","#FFFFFF","#FFFFFF","bold 12px Comic Book Commando","bold 12px Comic Book Commando"]);


<?}?>


stm_ep();
stm_ep();
stm_ep();
stm_sc(1,["transparent","transparent","","",3,3,0,0,"#FFFFF7","#000000","up_disabled.gif","up_enabled.gif",7,9,0,"down_disabled.gif","down_enabled.gif",7,9,0,1,140]);
stm_em();


mais ca ne marche po

A savoir que je l'ai créé avec Sothink Dhtml menu
Tom's guide dans le monde
  • Allemagne
  • Italie
  • Irlande
  • Royaume Uni
  • Etats Unis
Suivre Tom's Guide
Inscrivez-vous à la Newsletter
  • ajouter à twitter
  • ajouter à facebook
  • ajouter un flux RSS