- This topic is empty.
-
AuthorPosts
-
December 21, 2009 at 2:03 pm #27287WildSpiritMember
I am working on a website that has over 100 pages. There have been a couple changes already to the navigation and I potentially see more coming…
Would be using PHP (something I have NO CLUE about) be worth looking into?
Going through each page to make a navigational correction is time consuming and tedious!!
I’m open to any ideas!
Thanks,
LyleDecember 21, 2009 at 2:35 pm #68448TheDocMemberCertainly! I almost always use a PHP include for the header/nav on static sites. It could be something as simple as:
The PHP: (I always keep all of my includes in a folder called "includes", but that’s a personal preference)
Code:and then in the nav.html file:
Code:December 21, 2009 at 2:35 pm #68449TheDocMemberAlso, remember for PHP to function properly, the page name will have to be .php, not .html.
December 21, 2009 at 4:29 pm #68459WildSpiritMemberOK I have no knowledge of PHP can you recommend a tutorial for this??…
I’m searching for stuff now but on the flip side I’m not a 100% positive what I’m looking for. Kindda like a catch22!
Thanks,
LyleDecember 21, 2009 at 5:03 pm #68463TheDocMemberHere’s a reeeeaaaaally simple demo:
This is your index.php page:
Code:
This is a Sample!
Sample
Hi, I’m content
And I’m a footer
And in a file located in a folder called "includes", your navigation.html file:
Code:It’s as simple as replacing everywhere your navigation is with this line:
<?php include(‘includes/navigation.html’); ?>Then you only have to update one file (navigation.html) whenever you want to make a change to it.
December 21, 2009 at 5:49 pm #68489WildSpiritMemberWOW that sounds more simple! That would make my life easier too!!
One more question: If using CSS to style my nav. how does that get worked in?
Going off the code below could I add a div with ID of nav around the php and that would add apply my styles?
<div id="header">
<h1>Sample</h1>
</div><!–close header–><div id="nav">
<?php include(‘includes/navigation.html’); ?>
</div>OR does my CSS need to use the ID of "mainnav"?
I hope this is making sense!
Thanks,
LyleDecember 21, 2009 at 7:16 pm #68491TheDocMemberI just put in "mainnav" because that’s what I usually call it.
Also, you DON’T need to wrap the <ul> in a <div>.
You can style the <ul> just like you would a <div>.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.