+ Reply to Thread
Results 1 to 3 of 3

Thread: A little help with Include PHP

  1. #1
    DarkDragonLord's Avatar
    DarkDragonLord is offline x10 Elder DarkDragonLord is an unknown quantity at this point
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    782

    A little help with Include PHP

    Hi guys, i always used a code to make my links in my webpage. But i dont know why it just dont work anymore.
    Help anyone?



    In the index.php where is the layout, the place i want to show the content i add this: (the $ddl was $page but since $ is just an array, then i can put any name)

    PHP Code:
    <?php if(isset($ddl)) { include ("$ddl.html");} else { include ("main.html"); } ?>
    (main.html is the home/starter 'content')

    THEN, the link would be:
    HTML Code:
    <a href="index.php?ddl=rospr" target="_self" title="Custom RO Sprites">Sprites</a>
    then, when i click in link, the place where i added the php include, would change and put the rospr.html content. The thing is: ISNT working anymore. Did i misstyped anything ? i was testing here at x10 but just stay the main.html, do not change to the page i call in the link.

    THANKS, who make this thing work, i'll give a cookie.

    Cya
    DDL
    Last edited by DarkDragonLord; 08-14-2007 at 04:37 PM.
    Regards,
    Raphael DDL

    Designing Solutions for You
    *Web Design;
    *Coding;
    Free Downloads;
    and all related Stuff
    .


    My Tutorials:
    | Multi-Language Websites | Rotative Banners |
    | Bookmark Script for All Browsers
    |
    |
    PHP Switching/Including Content|
    |


  2. #2
    Brandon's Avatar
    Brandon is offline Former Senior Account Rep Brandon is on a distinguished road
    Join Date
    Jun 2006
    Location
    Tewksbury, MA
    Posts
    9,589

    Re: A little help with Include PHP

    Can you try this and tell me if it works.

    PHP Code:
    <?php if(isset($_GET[ddl])) { include ($_GET[ddl].".html");} else { include ("main.html"); } ?>
    That should, in fact, make it work.
    Thanks,
    Brandon Long

  3. #3
    DarkDragonLord's Avatar
    DarkDragonLord is offline x10 Elder DarkDragonLord is an unknown quantity at this point
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    782

    Re: A little help with Include PHP

    The php god has spoken :O
    Ya, that worked really nice!

    Thanks xDDD~

    Btw, i was trying edit but since its updating forums, the edit just give me internal server error.

    There is any way to include a 404 error when none $ddl or main.html are not found? to not show this:
    PHP Code:
    Warning: include(roscreen.html) [function.include]: failed to open streamNo such file or directory in /home/darkdrag/public_html/test/index.php on line 188

    Warning
    : include() [function.include]: Failed opening 'roscreen.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php'in /home/darkdrag/public_html/test/index.php on line 188 
    So, i'llmake a 404.html and when someone put the link wrongly (like index.php?ddl=rosrp instead of rospr) it shows the 404 not that bunch of include errors?


    Thanks again.

    btw, you are updating forums so i cant give you the points O.o i just noticed now >.< when come back i'll give ya

    DDL
    Regards,
    Raphael DDL

    Designing Solutions for You
    *Web Design;
    *Coding;
    Free Downloads;
    and all related Stuff
    .


    My Tutorials:
    | Multi-Language Websites | Rotative Banners |
    | Bookmark Script for All Browsers
    |
    |
    PHP Switching/Including Content|
    |


+ Reply to Thread

Similar Threads

  1. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  2. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  3. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM
  4. PHP Include Support
    By Afterburn in forum Free Hosting
    Replies: 5
    Last Post: 07-05-2006, 09:01 PM
  5. Include php into Html
    By Tyler in forum Scripts & 3rd Party Apps
    Replies: 11
    Last Post: 07-13-2005, 08:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers