PDA

View Full Version : How do I do this in php3/4 ?



Nick
October 28th, 2000, 01:21
I want to make my site with tutorials templated with php4. I want to have it setup to do http://me.com/tutorials/index.php?id=1 would include the tutorial from "files/1.inc", http://me.com/tutorials/index.php?id=dammit would open "files/dammit.inc", etc. Can this be done? How? What would the code be?

[Edited by Nick on 10-28-2000 at 02:46 PM]

Gonzo
October 29th, 2000, 13:06
Just contact me on ICQ and I can help you do it. 41967209

Tobias
October 29th, 2000, 18:45
it's pretty simple:

if ($id==1)
{
include "files/1.inc";
}
else if ($id=="dammit")
{
include "files/dammit.inc";
}

- Tobias

Gonzo
October 29th, 2000, 20:57
No that way is the hard way. just do this:

if (isset($id)) {
include "files/$id.inc";
break;
} else {
echo "error or the main page";
}


Originally posted by Tobias
it's pretty simple:

if ($id==1)
{
include "files/1.inc";
}
else if ($id=="dammit")
{
include "files/dammit.inc";
}

- Tobias

Nick
October 29th, 2000, 21:15
Thanks man.



Originally posted by Gonzo
No that way is the hard way. just do this:

if (isset($id)) {
include "files/$id.inc";
break;
} else {
echo "error or the main page";
}


Originally posted by Tobias
it's pretty simple:

if ($id==1)
{
include "files/1.inc";
}
else if ($id=="dammit")
{
include "files/dammit.inc";
}

- Tobias