Thats a very common layout and you can download these css layouts free from many sources like http://layouts.ironmyers.com or http://www.dynamicdrive.com/style/layouts/category/C9/
If you want the left sidebar and main area to have colored backgrounds then you might want to look into the faux column technique. This keeps the columns (colors) even at the bottom no matter how much or how little content there is in the columns.
http://www.recipester.org/Recipe:Create_CSS_faux_column_36537892
Just another quick question, how do you make the menus? Just on my website atm (see sig), my menu bar html links on each page, which i have to edit every single page, everytime i want to add/remove a page.. Is there another way of doing so..? Could i prefrebly put it into the CSS?
If you want to just have one file which contains the entire menu for any page on your site, you should look into .php and the include function.
Allows you to have a single piece of html somewhere that can be "included" anywhere you call it.
I do my header, menu and footer like this. Only one file to edit instead of doing "search and replace".
<li class="current_page_item"><a href="DoingDoE.html">Doing DofE</a></li>
<li><a href="ContactUs.html">Contact Us</a></li>
There's a couple methods for marking a current page. For me each page has a $pid (Page ID) variable set from the PHP section, then in my navigation code I check for the $pid and set the class appropriately. You could also do some checks that the file name given in the link matches what's in the current URL to identify the current page.
<?php
// index.php
$pid = 'home';
?>
// navigation.php
<ul>
<li<?php if ($pid == 'home') { echo ' class="current"'; } ?>><a href="/">Home</a></li>
<?php
// navigation.php
$currentPage = $_SERVER['PHP_SELF'];
?>
<ul>
<li<?php if ($currentPage == '/' || $currentPage == '/index.php') { echo ' class="current"'; } ?>><a href="/">Home</a></li>
Is there a way to still keep the current page bit...? thanks![]()
<body class="about-us">
<ul>
<li class="home"><a href="index.php">Home</a></li>
<li class="about-us"><a href="about-us.php">About Us</a></li>
</ul>
</body>
body.home .home,
body.about-us .about-us {
color: red;
}
Here's a basic example. This write-up also uses a similar approach as below.
This has the bad part in that you have to add a $pid to every page that exists in your navigation.PHP:<?php // index.php $pid = 'home'; ?> // navigation.php <ul> <li<?php if ($pid == 'home') { echo ' class="current"'; } ?>><a href="/">Home</a></li>
Alternatively, you can get the current URL path by using $_SERVER['PHP_SELF'], and then check against that.
This way tends to be less precise and if you change a file name you'll need to change it here as well.PHP:<?php // navigation.php $currentPage = $_SERVER['PHP_SELF']; ?> <ul> <li<?php if ($currentPage == '/' || $currentPage == '/index.php') { echo ' class="current"'; } ?>><a href="/">Home</a></li>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<html>
<div id="menu">
<ul>
<li><a href="index.html" <?php if ($currentPage=="Home") echo "class="current_page_item""; ?>>Home</a></li>
<li><a href="Blog.html" <?php if ($currentPage=="Blog") echo "class="current_page_item""; ?>>Blog</a></li>
<li><a href="Gallery.html" <?php if ($currentPage=="Gallery") echo "class="current_page_item""; ?>>Gallery</a></li>
<li><a href="Documents.html" <?php if ($currentPage=="Documents") echo "class="current_page_item""; ?>>Documents</a></li>
<li><a href="DoingDoE.html" <?php if ($currentPage=="DoingDoE") echo "class="current_page_item""; ?>>Doing DofE</a></li>
<li><a href="ContactUs.html" <?php if ($currentPage=="ContactUs") echo "class="current_page_item""; ?>>Contact Us</a></li>
<li><a href="Forum.html" <?php if ($currentPage=="Forum") echo "class="current_page_item""; ?>>Forum</a></li>
</ul>
</div>
<?php $pid = 'Home';?>
echo "class="current_page_item"";
echo 'class="current_page_item"';
These would be your problems:
You can't use double quotes inside double quotes. Use,PHP:echo "class="current_page_item"";
notice how the syntax color is different, which is often a good way to find coding problems.PHP:echo 'class="current_page_item"';