Hello,
I am new to this forum. I really like how this community is involved.
So here is my questions;
1) I have done work in php, but i want to know how do you guys normally set up your site for a 15-20 webpages (Your folder directories and how you link your pages). Like i normally would do a folder called php and i make a footer.php, header.php and so on. Then i add one more folder called a query.php and in that page would have stuff like this;
<?php
// This is a very basic query script.
// To make this work you would include this query.php on the index.php where you want your content to go.
// the links for your buttons would look like this index.php?id=idhere
// after index.php?id= you would put the ID name. for example, the about me page would be index.php?id=aboutme
// This one looks diffrent from the rest for a good reason!
// i cant go into if and or statements now. but they will be covered in that oreilly book!
// this one looks for an id in the address. if there is no ID(just index.php) it would load the home id. which is simply home
if (($GET['id'] == "home") or ($GET['id'] =="")) {
include("pages/home.php"); // i dont need to explain that one 😉
}
// now these dont have the or statement... so these only load if you call them.
// this one would be index.php?id=aboutme
if($_GET['id'] == "aboutme") {
include("pages/aboutme/aboutme.php");
}
// index.php?id=webdesign
if($_GET['id'] == "webdesign") {
include("pages/webdesign/webdesign.php");
}
// index.php?id=portfolio
if($_GET['id'] == "portfolio") {
include("pages/port/port.php");
}
// index.php?id=rssfeed
if($_GET['id'] == "rssfeed") {
include("pages/rssfeed/rssfeed.php");
}
// index.php?id=contact
if($_GET['id'] == "contact") {
include("pages/contact/contact.php");
}
// index.php?id=conformation
if($_GET['id'] == "conformation") {
include("pages/contact/conformation.php");
}
// index.php?id=credits
if($GET['id'] == "credits") {
include("pages/credits.php");
}
// also note that you can change the ID to anything... like if you wanted index.php?page=credits you would change each string like so
// if($GET['page'] == "credits") {
// instead of if($_GET['id'] == "credits") {
// but for this id works fine 🙂
?>
Is there an easier way of doing all of this setup. Please give me suggestioin on how you guys do it when you first create the page using php?
2) How can I shorten my url to look something like this http://myurl.com/contactus.php instead of this long url http://myurl.com/index.php?id=contact?
or even instead of the php for the short url do it like .html instead?
Please bare with me, I am still new to this kind of stuff I just want to make my work load simple as possible.
Thanks,
Kevin