Okay... I'm using PHP right now and am using includes for the header/footer/etc that is constant on EVERY page. This way I can just update one html file and every page is updated.However, I've run into a problem when it comes to this but wanting to do it for sub navigation. I want the page it's on w/in the subnav to be bold and have no link, but can't figure out the best way to do this.What's the best way to go about doing this?assign each page an id and figure it out that way somehow via css?or make the navigation a separate php file where i can pass it a certain parameter on the pages and it can use it's own code to assign the bold/no link that way?i guess i'm down to css or php, b/c i'm sure i can figure it out, but w/ php it may cost load times (although i'm sure nothing noticeable)example (hardcoded):<div id="subnav"><ul id="subnav"><li><strong>Item 1</strong></li><li><a href="#">Item 2</a></li><li><a href="#">Item 3</a></li></ul></div>example (css): this way they will all have to be links and won't be able to remove them (which i don't like, but can live w/ it)<body id="blah">...<div id="subnav"><ul id="subnav"><li id="item_1"><a href="#">Item 1</a></li><li id="item_1"><a href="#">Item 2</a></li><li id="item_1"><a href="#">Item 3</a></li></ul></div>example (php): this would use code in the subnav.php file to make the item with "item_1" as its id to have no link and be bold<div id="subnav"><ul id="subnav"><?php include("subnav.php&page=item_1"); ?> --- would that even work, or what's the format? </ul></div>I'd like to be able to make updates to the number of items and titles/links of the items in one place and not have to change the bold/whatever on EVERY SINGLE PAGE and it take FOREVER.if this is confusing help me clarify it.[Edited on July 6, 2006 at 10:09 PM. Reason : ]
7/6/2006 10:01:47 PM
the way i'd do it would be to write up the whole subnav code in an include file, put all the subnav options in a database table, query it, have a while($ROW=mysql_fetch_object($result)) run, and be sorta like
if($ROW->link==$PHP_SELF) echo "<strong>$ROW->linkname</strong>";else echo "<a href='$ROW->link'>$ROW->linkname</a>";
7/6/2006 10:22:40 PM
i've got it working using phpavoiding mysql for this b/c it'd be faster w/o it since i don't have much data to work with
7/6/2006 11:31:30 PM
yeah i just said mysql because it'd be quicker to modify/update/add items to the subnav
7/6/2006 11:49:26 PM
subnav.php$output = "";for($i=0;$i<numPage;$i++){ $output += "<li class=\"item"; if($i == $page){ $output += " itemselect"; } $output += "\"><a href="$whatever">$whatever2</a></li>}echo $output;------------------------------subnav.css#subnav li.item { whateverstyle;}#subnav li.itemselect { font-weight: bold; }-----------------------------outputs<div id="subnav"><ul id="subnav"><li class="item itemselect">Item 1</li><li class="item"><a href="#">Item 2</a></li><li class="item"><a href="#">Item 3</a></li></ul></div>
7/7/2006 7:25:30 PM
i made a variable on the main page and then did the include on subnav.php which used that variable from the main page to know which item was to be selected.i just did if statements so it's easier to add content and switch it around.
7/8/2006 2:28:53 PM