Creating pages using php?
Posted: Mon Aug 14, 2006 3:03 am
Everah | Please use
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
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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;Code: Select all
<?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
?>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
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]