
March 24th, 2003
09:34 PM
Re: The ultimate page.php?page=blah / query strings / easy template tutorial
Originally posted by Ares
Now, something that will cause many of you problems is register_globals. If its on, using $queryStringVar when going to page.php?queryStringVar=tom wont print out anything.
Ares, quick note.
register_globals ON means that $queryStringVar will be set.
register_globals OFF means that it will not be set.
Just a little inconsistency some people might get conf00zed by 
___________________
Adam Goossens -- PHP is my mother tounge.
Linux: ( kernel.org | winehq ) -- f33l the p0w3r.
Nobody replying to your questions? Getting flamed? Getting told to RTFM? Ask your questions the right way.

March 24th, 2003
10:02 PM
Originally posted by Jeb.
Try replacing $_GET with $HTTP_GET_VARS.
If that doesn't work, I'm stumped.
Awesome, it works! Thanks Jeb!
___________________
I like pie.

March 25th, 2003
11:23 AM
TF Retiree
Status: Offline!
Why use switch and not include? I don't see what's wrong with it, unless there's a security bug somewhere. And, aren't vars supposed to begin with a letter, or was that just CSS..
Edit: Also, it would probably be better not to use XHTML in your code, since if their doctypes and such are wrong, it may cause errors at some point.
Edit2: If none of that made sense, basically I'm trying to say that switches have too much extra syntax.
Last edited by Dan1, March 25th, 2003 11:43 AM (Edited 1 times)

March 25th, 2003
11:37 AM
<? print '<? XML...blah ?>'; ?>
___________________
http://celerondude.com

March 25th, 2003
11:43 AM
heh.. $1337 should be $_1337
___________________
» DirectWD HTML / JavaScript / XHTML / CSS / PHP / MySQL
Direct Web Design

March 30th, 2003
07:27 PM
If your lazy like me, heres code for dynamic includes.
*.php?page=*.php
This is 100% secure to my knoledge, all pages must be .php and be in THE BASE DIR! meaning you CAN NOT include /forums/index.php or /info/stuff.php but has to be whatever.php Enojy if you want to use it. Ill post another one i wrote that is also secure later.
<?php
if (isset($_GET['page']) && is_file(basename($_GET['page']))) {
include(basename($_GET['page']));
} else {
include(basename('404.php'));
}
?>
___________________
i stupended my own signarture

April 2nd, 2003
01:52 AM
please help
Please help me!
I am trying to figure out these query strings for about a week now ive really been looking for things but none of them have fixed my problem!
How do i do it so when it tells it to goto page=test it only uses the code in test.php?
every page ive tryed and all the code ive tryed the pages just overlap each other and the page/text is included twice!
The problem i think is that im including a page into a page but i don't know how to get around that.
Thanks for any help, its hard to explain, if you need any code or anything or to post my test pages of my site i can do so. but i didn't really want to post the url for everyone to see, maybe i can PM.
___________________


April 2nd, 2003
02:03 AM
TF Retiree
Status: Offline!
If you could post an example I'd be glad to take a look.

April 2nd, 2003
03:32 AM
LOL after SO MANY HOURS ive worked it out and its so newbieish what it was.
I do know quite alot of php and have been building my site (http://www.code-9.com) for quite some time now.
You guys should really make clear all the query code needs to be in a TOTALLY SEPERATE PHP FILE to everything else. THIS IS REALLY WHAT I THINK PEOPLE ARE GETTING WRONG!
Iwas putting this code into my index/home.php and thats why it was f***ing up.
I feel such a newb now but you live and learn!
___________________


April 2nd, 2003
04:11 AM
Neverside Newbie
Status: Offline!
So what would be the best way for the code below to print sub navigation links on a page then for the page that is being viewed, do not display the hyperlink.
<?php
if ($_GET["page"] == "resume") {
print "<p class=\"subnav\">Resume</p>";
} else {
print "<p class=\"subnav\"><a href=\"about_me/resume/\">Resume</a></p>";
}
if ($_GET["page"] == "interests") {
print "<p class=\"subnav\">Interests</p>";
} else {
print "<p class=\"subnav\"><img src<a href=\"about_me/interests/\">Interests</a></p>";
}
?>
What is the difference between using if/else statements and case/break?
___________________
Best Regards,
John Saunders