Jump to content

building a dynamic drop down menu...


acsonline

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.