Also, you should know that for development I'm using exclusively NetBeans. The only other HTML editor I have access to is Microsoft Expression Web, but I don't like it very much. Dreamweaver is too expensive for me.
So, my main question is how to organize a website. Because I think right now both my work and personal websites are organized very oddly. Here is the body of index.php from my personal site:
<body>
<div id="wrap">
<div id="header">
<h1>Yet Another Homepage</h1>
<h2>By (My Name)</h2>
</div>
<div id="menu">
<ul>
<li><a href="index.php" >Home</a></li>
<li><a onclick="changePageAndNav('Projects/main.php', 'Projects/projectsNav.php');">Projects</a></li>
<li><a onclick="changePageAndNav('About/main.php', 'About/aboutNav.php');">About Me</a></li>
</ul>
</div>
<div id="content">
<div class="right">
<?php
if ($_GET["page"] == null) {
include "Home/main.php";
} else {
include $_GET["page"];
}
?>
</div>
<div class="left">
<?php
if ($_GET["subNav"] != null) {
include $_GET["subNav"];
}?>
</div>
<div id="bottom">
<a onClick="toTop();">Back to Top</a>
</div>
</div>
<div id="footer">
<p>© (My Name), 2009</p>
</div>
</div>
</body>
<div id="wrap">
<div id="header">
<h1>Yet Another Homepage</h1>
<h2>By (My Name)</h2>
</div>
<div id="menu">
<ul>
<li><a href="index.php" >Home</a></li>
<li><a onclick="changePageAndNav('Projects/main.php', 'Projects/projectsNav.php');">Projects</a></li>
<li><a onclick="changePageAndNav('About/main.php', 'About/aboutNav.php');">About Me</a></li>
</ul>
</div>
<div id="content">
<div class="right">
<?php
if ($_GET["page"] == null) {
include "Home/main.php";
} else {
include $_GET["page"];
}
?>
</div>
<div class="left">
<?php
if ($_GET["subNav"] != null) {
include $_GET["subNav"];
}?>
</div>
<div id="bottom">
<a onClick="toTop();">Back to Top</a>
</div>
</div>
<div id="footer">
<p>© (My Name), 2009</p>
</div>
</div>
</body>
Basically, the index.php file acts as a wrapper around all the other content on my page. When ever you click on a Menu or SubNav link it will call the javascript function changePageAndNav which just changes the URL parameters, it's code is:
function changePageAndNav(page, subNav){
window.location = "?page=" + page + "&subNav=" + subNav;
}
window.location = "?page=" + page + "&subNav=" + subNav;
}
This will reload index.php and will cause it to include the proper page and navigation bar. The included pages contain the bare minimum amount of code, without any body tags.
The plus side to doing things this way is consistent layout of the page, and very little duplicated code. And if I ever want to change the layout, I only need to change index.php.
On the negative side, I am left with large ugly url's that people can mess with. Such as:
http://domain.com/?page=Projects/main.php&subNav=Projects/projectsNav.php
Can anyone suggest a better way to organize the website?
