...

View Full Version : Include & Querystring



DaveHope
12-20-2003, 07:10 PM
I was adding pages to my website (whilst trying to keep it xhtml1.1 compliant) and have a font tag in my header include file (a file which gets added to every page on my site to make code updates easier). I came to a few pages which didn't need that one line, so I figured adding a querystring check to the font line would be the best solution. So, if I include "Includes/Header.php?Mode=nofont" using Include(); the font line isn't used. However, as you've probably guessed by now this doesn't work. I thought that I'd made a typo and checked the header file and it's right. I just get the standard failed to open stream, file or dir doesn't exist error. Anyone come across this before and have a workaround? or does anyone else have a suggestion ? :P

Celtboy
12-21-2003, 04:41 AM
when you "include" php code on a page, it's like inserting the code right in....why not:


on a page, do something similar to the following:


<?php
$mode="nofont";
include("Includes/Header.php");
?>

and in your header file,


if ($mode != "nofont") {
<insert your font code here>
} else {
<insert do nothing code here>
}

?

DaveHope
12-21-2003, 10:02 AM
Thanks very much, I really should have thought of that. :D

Celtboy
12-22-2003, 03:28 AM
no problem ;).

There may be a better way to do it, but uhm, I'll let someone else come up with it. :D <--- Horace (that's his name).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum