Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Include & Querystring

    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

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    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 Code:
    <?php
    $mode
    ="nofont";
    include(
    "Includes/Header.php");
    ?>
    and in your header file,
    PHP Code:
    if ($mode != "nofont") {
      <
    insert your font code here>
    } else {
      <
    insert do nothing code here>

    ?

  • #3
    New Coder
    Join Date
    Apr 2003
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks very much, I really should have thought of that.

  • #4
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    no problem .

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •