acsonline Posted March 3, 2011 Share Posted March 3, 2011 Hey Guys, I'm building a site and I need a drop down menu created dynamicly.... This is the flat html code <div class="art-nav"> <div class="l"></div> <div class="r"></div> <ul class="art-menu"> <li><a href="URL 1"><span class="l"></span><span class="r"></span><span class="t">TOP LEVEL</span></a> <ul> <li><a href="URL 1">SUB CAT 1</a></li> <li><a href="URL 2">SUB CAT 2</a></li> <li><a href="URL 3">SUB CAT 3</a></li> </ul> </li> <li class="art-menu-li-separator"><span class="art-menu-separator"></span></li> <li><a href="URL 5"><span class="l"></span><span class="r"></span><span class="t">Contact Us</span></a></li> </ul> </div> This is the code that shows a dyamic code, but not in the menu... <?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> get_option('show_category_thumbnails'))); ?> <a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link"><?php wpsc_print_category_name();?></a> | <?php wpsc_print_subcategory(); ?> <?php wpsc_end_category_query(); ?> Link to comment https://forums.phpfreaks.com/topic/229494-building-a-dynamic-drop-down-menu/ Share on other sites More sharing options...
Muddy_Funster Posted March 3, 2011 Share Posted March 3, 2011 I'm sorry, I can't actualy find a question in there. Link to comment https://forums.phpfreaks.com/topic/229494-building-a-dynamic-drop-down-menu/#findComment-1182401 Share on other sites More sharing options...
acsonline Posted March 3, 2011 Author Share Posted March 3, 2011 oh, urm, I meant to ask, how can I do this? Link to comment https://forums.phpfreaks.com/topic/229494-building-a-dynamic-drop-down-menu/#findComment-1182403 Share on other sites More sharing options...
Muddy_Funster Posted March 3, 2011 Share Posted March 3, 2011 ok, couple of things - you know you don't need to open and close every line of php code with <?php ?> right?, also, where are you populating your array from? is it hard coded into the page (cause if it is it's still not "dynamic", it's just a more complicated way of doing what's already done in html)? Link to comment https://forums.phpfreaks.com/topic/229494-building-a-dynamic-drop-down-menu/#findComment-1182406 Share on other sites More sharing options...
acsonline Posted March 3, 2011 Author Share Posted March 3, 2011 ah this is generated from a wordpress site, so taken from the DB... I do, but for some reason I just feel safer adding it lol This is the code I've now edited, but the trouble I am having is generating the drop downs for the sub categories <div class="art-nav"> <div class="l"></div> <div class="r"></div> <ul class="art-menu"> <?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> get_option('show_category_thumbnails'))); ?> <?php //wpsc_print_subcategory(); ?> <li><a href="<?php wpsc_print_category_url();?>"><span class="l"></span><span class="r"></span><span class="t"><?php wpsc_print_category_name();?></a></span></a></li> <li class="art-menu-li-separator"><span class="art-menu-separator"></span></li> <?php wpsc_end_category_query(); ?> </ul> </div> This code: < ?php wpsc_print_subcategory(); ?> can have html attributes added to it, ie. < ?php wpsc_print_subcategory("<ul>", ""); ?> however I'm not 100% sure how to code the attributes.. Link to comment https://forums.phpfreaks.com/topic/229494-building-a-dynamic-drop-down-menu/#findComment-1182424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.