kit Posted September 17, 2006 Share Posted September 17, 2006 I’m sorry if the is comes over a little confused, I am a total newbie!At the moment I have a Navigation bar list put into boxes with css, and it works fine.But what I want to do is make the second level, bulleted and not in boxes, so it is easier to see that they are sub levels.Any help would be great. Sorry if I gave too much code, not sure what you needed too see.Thanks![code]<?phpif (!defined('WEB_ROOT')) { exit;}// get all categories$categories = fetchCategories();// format the categories for display$categories = formatCategories($categories, $catId);?><ul> <li><a href="<?php echo $_SERVER['PHP_SELF']; ?>">All Products </a></li><?phpforeach ($categories as $category) { extract($category); // now we have $cat_id, $cat_parent_id, $cat_name $level = ($cat_parent_id == 0) ? 1 : 2; $url = $_SERVER['PHP_SELF'] . "?c=$cat_id"; // for second level categories we print extra spaces to give // indentation look if ($level == 2) { $cat_name = ' » ' . $cat_name; } // assign id="current" for the currently selected category // this will highlight the category name $listId = ''; if ($cat_id == $catId) { $listId = ' id="current"'; }?><li<?php echo $listId; ?>><a href="<?php echo $url; ?>"><?php echo $cat_name; ?></a></li><?php}?></ul>[/code]css...//#leftnav { //width: 150px; //font-size: 12px; //vertical-align: top; //font-size: 85%; //font-family: Arial, Helvetica, sans-serif; //color: #000000;}ul, ol { font-family: Georgia, "Times New Roman", Times, serif;}#leftnav a { padding: 3px; display: block; border: 1px solid #000099; text-decoration: none; line-height: 1em; width: 150px; background-color: #7AD8CE;}#leftnav a:link, #leftnav a:visited { color: #003399;}#leftnav a:hover, #leftnav a:active { color: #FFFFFF; background-color: #6699CC; border: 1px solid #000;}#leftnav ul { /*/*/padding: 0em; margin-left: 0em; margin-right: 0em; list-style-type: none; /* */}#leftnav li { /*/*/margin: 0px 0px 6px 0px; /* */ }#current a { color: #FFFFFF !important; /*/*/background-color: #99CCFF!important; border: 2px solid #003399!important; /* */ Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/ Share on other sites More sharing options...
ToonMariner Posted September 18, 2006 Share Posted September 18, 2006 without reading all that you can use thisul { some decalrations that apply to top level}ul ul { some declarations that apply to an unordered list inside an unordered list.} Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-93876 Share on other sites More sharing options...
kit Posted September 18, 2006 Author Share Posted September 18, 2006 ToonMariner, thanks for the help.I'm sorry for being so stupid, but this is the first website i have ever made.Where do I put them? *ducks all vertual slaps, rotten Tomatoes etc* Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-93903 Share on other sites More sharing options...
ToonMariner Posted September 18, 2006 Share Posted September 18, 2006 In your style sheet..... Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-93910 Share on other sites More sharing options...
kit Posted September 18, 2006 Author Share Posted September 18, 2006 how does that then transfer to the code page? Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-93915 Share on other sites More sharing options...
ToonMariner Posted September 18, 2006 Share Posted September 18, 2006 Your html will look like something like this (not checked your code - if your code does not create this change it so it does - that is good practice for html)...[code]<ul> <li>Item</li> <li>Item</li> <li>item <ul> <li>Sub Item</li> <li>Sub Item</li> </ul> </li> <li>Item</li></ul>[/code]and in your style sheet is the ul ul bit.If this is a navigation type list then stick ALL the html for the unordered lists inside a div with id="nav"then you can further refine you css to #nav ul { // attributes for top level list}#nav ul ul { // attributes for sub lists} Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-93996 Share on other sites More sharing options...
kit Posted September 18, 2006 Author Share Posted September 18, 2006 Thank you ;D Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-94007 Share on other sites More sharing options...
kit Posted September 19, 2006 Author Share Posted September 19, 2006 Sorry! thought I had it, but I'm still stuck. Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-94682 Share on other sites More sharing options...
Daniel0 Posted September 19, 2006 Share Posted September 19, 2006 Something like this should do it (I know it is ugly): [code]<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"><head><title>Test</title><style type="text/css">ul{ background-color: blue;}ul ul{ background-color: green;}ul ul ul{ background-color: red;}ul ul ul ul{ background-color: yellow;}</style></head><body><ul> <li> test </li> <li> test </li> <li> <ul> <li>test</li> <li>test</li> <li> <ul> <li>test</li> <li>test</li> <li> <ul> <li>test</li> <li>test</li> </ul> </li> </ul> </li> </ul> </li></ul></body></html>[/code]You just need to style it better though. Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-94834 Share on other sites More sharing options...
kit Posted September 20, 2006 Author Share Posted September 20, 2006 Ok, when I look at the source code on my website, it is laid out like the above. But it is still not working.Maybe I made a mistake and it is the php code?Changes made #leftnav ul ul { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; list-style-position: outside; list-style-type: disc;[code]<ul><li<?php echo $listId; ?>><a href="<?php echo $url; ?>"><?php echo $cat_name; ?></a></li></ul>[/code]Thanks for your patience. Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-95241 Share on other sites More sharing options...
kit Posted October 28, 2006 Author Share Posted October 28, 2006 Hi .. sorry me again :-[Can anybody help?Thanks Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-115832 Share on other sites More sharing options...
ToonMariner Posted October 28, 2006 Share Posted October 28, 2006 You will need to set the margin of your sub list li elements! the top level has margin & paddin 0 this is inherited by child elements so make sure you give ul ul li{ margin: 0 0 0 5px;} Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-115834 Share on other sites More sharing options...
kit Posted October 28, 2006 Author Share Posted October 28, 2006 Thank youThe sub level is still in a blue boxes (same as the top level).It all works fine I would just like the sub levels to be different from the main levels, but nothing I have tried seems to work.??? Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-115853 Share on other sites More sharing options...
ToonMariner Posted October 28, 2006 Share Posted October 28, 2006 I suspect you are setting the background colour of the a tag still - which will override any li or ul background colors. Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-115856 Share on other sites More sharing options...
kit Posted October 28, 2006 Author Share Posted October 28, 2006 [img]http://www.justcaroline.co.uk/images/navbar.gif[/img]This is what it looks like.yes I think the bg a tag is the problem, it is the colour that makes it look like its in a light blue box. I have tried, changing this but when I put the bg colur on the ul or ul ul it doesnt put each title in a seperate box just one big one.Maybe I should just give up. Can anyone recommend a template or tutorial I can use for the same effect. Quote Link to comment https://forums.phpfreaks.com/topic/21081-changing-the-2end-level/#findComment-115867 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.