
April 17th, 2003
10:03 AM
[QUOTE][i]Originally posted by TrigBoy [/i]
[B]yeh it could be used for comparing.
eg
[PHP]
If($_1337['DirectWD'] > $_1337['TrigBoy'])
{
echo "Neg";
}
else
{
echo "Thats more like it";
}
[/PHP][/QUOTE]
$_1337 is not a registered global unless you are using register globals ON in which your if statement still would be incorrect.
___________________
» DirectWD HTML / JavaScript / XHTML / CSS / PHP / MySQL
Direct Web Design

April 23rd, 2003
04:50 PM
isn't this:
a lot faster than a switch statement?
It's probably hardly noticeable with just a few cases, but if there were hundreds of cases...
To make it a little more secure (sorta like KungPaoChicken was talking about) having it point to a folder like pages or includes so all pages that could be included would be in that folder:
<?php
$page2include = "includes/$page.php";
include $page2include;
?>
Does anybody know if there is anything wrong with doing it this way?

April 23rd, 2003
05:05 PM
my biography
Status: Offline!
<?
$links = array(
'csstut_basic.php',
'csstut_scrollbars.php'
);
if (isset($_GET['page']))
{
$page = $_GET['page'];
if(in_array($page,$links))
{
include("$page");
}
else
{
echo "bog off!";
};
}
else
{
include("index_content.php");
};
?>
surely that works fine, and if you use a db instead of an array you can update it from anywhere, w/out adding a new case statement?
___________________
Infinite Fire - Photoshop, PHP, HTML, CSS and Webmaster Tutorials - Web Design Centre
Photoshop Tutorials | PHP Tutorials | HTML Tutorials | Webmaster Tips and Tricks
Buy Cheap Digital Cameras!

April 23rd, 2003
05:11 PM
But it's going to have hundreds, probably thousands of pages. I think having to define an array with a thousand variables everytime a page is called would slow down the cpu.

April 23rd, 2003
05:57 PM
my biography
Status: Offline!
hmmm possibly, but most people here dont have 1000+ pages on their site, i have approx 50 and i see no loss in speed, and is v.secure - i see your point though
___________________
Infinite Fire - Photoshop, PHP, HTML, CSS and Webmaster Tutorials - Web Design Centre
Photoshop Tutorials | PHP Tutorials | HTML Tutorials | Webmaster Tips and Tricks
Buy Cheap Digital Cameras!

May 9th, 2003
09:01 AM
Came in from google after doing a search for template tuttorials. I was wondering if anyone could give a code example of this if the content is stored in mySQL? Or maybe how to read a template from a file into a string, then just replace the variables there with the content from the database, then output to the browser.
Any help/examples would be greatly appreciated, thank you.

May 28th, 2003
04:12 AM
what about something like:
http://mysite.com/index.php?HELLO
Varible = HELLO
Is that possible???

May 29th, 2003
07:56 PM
as i do hate to bump this thread, i cant figure out how to not have to use the varriable.. so it is like yoursite.com/?news, yoursite.com/?forum, ect, ect...
___________________
....

May 29th, 2003
08:28 PM
TF Retiree
Status: Offline!
Well, the default page is automatically index.php, so having ?varstuff is ok. As to how to do it, read the following.
<?php
$query = $_SERVER["QUERY_STRING"];
isset($query) ? $query.".txt" : "default.txt";
if(file_exists($query))
{
include $query;
}
else
{
echo "Error!";
}
?>
$_SERVER["QUERY_STRING"]; is the equivalent of everything after the ?.

June 8th, 2003
07:36 PM
My site's pages are located trough multiple directories, So I tried the code, and it didnt work. I think that may be the problem because when I put in
www.mysitehere.com/test.php?id=contact
for example, it just takes me to my default page. I tried using my absoloute path as well and it didnt work... here is what I have in test.php
<?php
switch( $HTTP_GET_VARS['what'] ) {
case 'contact' :
include '/home/virtual/site73/fst/var/www/html/site/contact/index.php';
break;
case 'contact' :
default:
include 'main.php';
break;
}
?>
___________________
Signature Suspended as it is in violation with the signature rules