Dropdown menu kobles sammen med database
Hej,Jeg har fundet en rigtig flot dropdown menu, som jeg vildt gerne vil have koblet sammen min menu tabel i min MYSQL database. Problemet er bare at jeg ikke ved hvordan, så jeg håber der er nogen der kan hjælpe her!
Min tabel i MySQL ser sådan her ud:
TABLE 'menu'
id
titel
link
knytning
det felt bruges til at lave undermenuer, dvs. at her gemmes id på det der skal være hovedmenu!
Nu vil jeg så gerne have gjort sådan at mine variabler fra databasen bliver sat ind i et stykke kode, så det bliver udskrevt på følgende måde:
with(milonic=new menuname("$titel")){
alwaysvisible=1;
left=170;
margin=2;
orientation="horizontal";
style=horizStyle;
top=190;
aI("showmenu=Sample $titel;text=$titel;");
aI("showmenu=Sample $titel;text=$titel;");
aI("showmenu=Sample $titel;text=$titel;");
aI("showmenu=Sample $titel;text=$titel;");
aI("showmenu=Sample $titel;text=$titel;url=$link;");
}
with(milonic=new menuname("Sample $titel")){
margin=3;
style=vertStyle;
top="offset=2";
aI("text=$titel;url=$url;");
}
her er hvordan scriptet normalt ser ud:
with(milonic=new menuname("Sample mainmenu")){
alwaysvisible=1;
left=170;
margin=2;
orientation="horizontal";
style=horizStyle;
top=190;
aI("text=Home;title=Back to Home Page;url=/;");
aI("showmenu=Sample about;text=About Milonic;");
aI("showmenu=Sample dhtml menu;text=DHTML Menu;");
aI("showmenu=Sample products;text=Products;");
aI("showmenu=Sample support menu;text=Support;");
aI("showmenu=Sample my milonic;text=My Milonic;url=mymilonic.php;");
aI("showmenu=Sample search;text=Search;url=/search.php;");
}
with(milonic=new menuname("Sample about")){
margin=3;
style=vertStyle;
top="offset=2";
aI("image=18_about.gif;text=About Us;url=/aboutus.php;");
aI("image=18_testimonial.gif;text=Testimonials;url=/testimonials.php;");
aI("image=18_corporate.gif;text=Distinguished Clients;url=/corp_customers.php;");
aI("image=18_nonprofit.gif;text=Investing in Non-Profits;url=/nonprofits.php;");
aI("image=18_where.gif;text=Where Are We;url=/location.php;");
aI("image=18_contact.gif;text=Contact Us;url=/contactus.php;");
aI("image=18_privacy.gif;text=Privacy Policy;url=/privacy.php;");
aI("image=18_license.gif;text=Software Licensing Agreement;url=/license.php;");
}
with(milonic=new menuname("Sample dhtml menu")){
margin=3;
style=vertStyle;
top="offset=2";
aI("image=18_purchase.gif;text=Software Purchasing Pages;url=/cbuy.php;");
aI("image=18_lic.gif;text=Licensing;url=/licensing.php;");
aI("image=18_freelic.gif;separatorsize=1;text=Free Licenses;url=/freelicreq.php;");
aI("showmenu=Sample menusamples;text=DHTML Menu Samples;url=/menu.php;");
aI("image=18_product.gif;text=Product Information;url=/productinfo.php;");
aI("image=18_integration.gif;text=Page Integration;url=/integration.php;");
aI("image=18_quick.gif;showmenu=Sample quickref;text=Menu Quick Reference Guides;");
aI("image=18_version.gif;separatorsize=1;text=Menu Version Information;url=/menuvinfo.php;");
aI("text=Frames Based Menu (version 3);url=/menu/frames/;");
aI("image=18_converter.gif;text=Version 3 to Version 5.0 Converter;url=/converter.php;");
aI("text=Menu Logos;url=/logos.php;");
aI("image=18_user.gif;text=List of DHTML Menu users;url=/list/;");
}
håber der er en der kan hjælpe med at få udskrevet det rigtige :)
