PDA

View Full Version : what does that mean?



ramo_integ
January 25th, 2005, 06:00 PM
when a site has extentions such as [.php?something=something]..(links belows) what does that mean ..how do you get your site to do that and what's the main purpose of doing that...what gets run in the background besides php?

someone please explain that 4me..thanx

/art.archive.php?type=articles
/art.archive.php?type=reviews

RushScripting
January 25th, 2005, 06:40 PM
That is just like a conditional. Using the $_GET super global to get info.

Take for instance the url was www.blah.com/index.php?act=go

if in your code you had



if( $_GET['act'] == go ){
echo"".$_GET['act']."";
}


This would echo go. Many people just use this as a conditional thing so that if act = whatever it will do what the code says. Im in a hurry so i can't explain much.

:D Hope this helps :D

Hans Kilian
January 25th, 2005, 08:44 PM
If you want to be pedantic, it doesn't mean anything. They're just two different URLs and what happens when you type them into your browser is entirely up to the webserver. It gets to interpret them in any way it sees fit.

But a standard webserver would interpret the URLs this way:

Find the file called 'art.archive.php' and pass it to the PHP interpreter along with whatever was after the name (type=articles or type=reviews). Then the PHP interpreter would run the script in the php file. The script would then look at the variable 'type' and see if it contains 'articles' or 'reviews' and return a webpage to you. The webpage would probably be different for the two requests even though it was generated by the same php script.

Hope that helps a bit.

Ben H
January 26th, 2005, 05:34 AM
when a site has extentions such as [.php?something=something]..(links belows) what does that mean ..how do you get your site to do that and what's the main purpose of doing that...what gets run in the background besides php?

someone please explain that 4me..thanx

/art.archive.php?type=articles
/art.archive.php?type=reviews

<?
$page = $_GET['type'];
switch ($type) {
case ("articles"):
include "includes/articles.php";
default:
include "index.php";
}
?>


That would probably do something like that, e.g. thatpage.php?type=articles would include includes/articles.php