...

View Full Version : file.php?page=whatever



mike_tw
06-07-2007, 09:54 AM
Hi,

Im noticing quite a bit of websites have urls like index.php?page=23241

Is this an example of a database driven website? Ive tried searching google for this page=whatever method but dont know how to word the search. What is this method called?

Also, I see some where there is a content area, when you click another link that area changes but the areas around it seem to stay exactly the same like header , side menu + footer. What is this method? Include?

Thanks for any info you can provide to help me :)

Thanks

GSimpson
06-07-2007, 10:11 AM
doesn't have to be database but could very well be. And yes it could very well have the variable in the url (?id=34343) and then going include($id);

It is a very smart way of doing things. Much better for the manager aswell.

croatiankid
06-07-2007, 10:16 AM
Those are most often $_GET variables.

mike_tw
06-07-2007, 10:40 AM
yes, I like the looks of it very much. Tidy and professional looking.

Which method do you use? Im going to be making a basic introductory website for a company soon and just looking at ways i could build it. Which way would you guys do it?

I think ill do that index.php?page=about

abduraooft
06-07-2007, 11:08 AM
yes, I like the looks of it very much. Tidy and professional looking.

Which method do you use? Im going to be making a basic introductory website for a company soon and just looking at ways i could build it. Which way would you guys do it?

I think ill do that index.php?page=about

If you wanna keep all the content in the same page, this method may be suitable


if($_GET['page']=='home')
{

<div class="content">
HOME CONTENT
</div>

}
else if(($_GET['page']=='about')
{

<div class="content">
ABOUT CONTENT
</div>

}
...............
..............
else
{

PAGE ERROR

}

GSimpson
06-07-2007, 12:43 PM
yep that's good. Or....


$mypage = "sources/" . $_GET['page'] . ".txt";
include($mypage);


your directory could look like:

index.php
style.css
sources/
home.txt
about.txt

and so on, so on. But that's just cause I don't like having a lot of coding.

mike_tw
06-07-2007, 01:34 PM
could i still use html tags in that .txt file? For images and such

mlseim
06-07-2007, 02:17 PM
PHP Include simply takes whatever file you want to include and sticks
it in the same spot as the "Include" ... all text verbatim. So, you can use
html, css, whatever. This all happens on the server before your page is
sent to the user.

croatiankid
06-07-2007, 10:42 PM
It looks "cool", but the thing is, it's actually much better to use a / architecture. This puts keywords in your URL (for SEO), and is human-readable.

mlseim
06-08-2007, 02:13 PM
Have a main page (index.php), and then, all other pages can
be one dynamic PHP script, example: page.php?p=2 or page.php?p=13

Those variables will determine which "includes" will be used for
the content of the pages. See example below ... mouse-over the
links in the menu, notice the URL. The actual menu can also be a
PHP script, so you only need to edit one file if you add more navigation
items (and the navigation script is also a PHP include).

http://www.palosantodesigns.com/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum