We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
PHP Help
Topic Started: Jan 31 2005, 07:20 PM (695 Views)
Dennis
Member
[ *  *  *  *  *  *  * ]
http://boredboards.com/

I just finished re-building the site in PHP, but the INCLUDE function isn't opening the pages. Any idea why?
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
There are no PHP errors on that page and you have provided no PHP code for us to debug. No one will be able to help you without this information.
Offline Profile Quote Post Goto Top
 
Dennis
Member
[ *  *  *  *  *  *  * ]
k, my index page content section has this:

Code:
 
<?php if(!$pageid || $pageid == ""){$pageid = "home";} ?>
<?php include("$pageid.php"); ?>


It opens the home.php fine, but whenever you click on a link, it doesn't work.
Offline Profile Quote Post Goto Top
 
Stefan
Member Avatar
Mew?
[ *  *  *  *  *  *  * ]
Code:
 
<?php
$pageid = $_GET['pageid'];

if(!$pageid){
  $pageid = "home";
}

include("$pageid.php");
?>

Perhaps that works.
Offline Profile Quote Post Goto Top
 
Dennis
Member
[ *  *  *  *  *  *  * ]
Hah! It worked. Thanks Stef. :)
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
refer to mine and Seth's posts about register globals:

http://invisionfree.com/forums/support/ind...dpost&p=2496240
Offline Profile Quote Post Goto Top
 
Zero Tolerance
Being me is not a good thing.
[ *  *  * ]
It's more than likely php errors will return if a user was to input ?page=omg and omg.php didn't exist, so...

Code:
 
<?php

$Page = $_GET['pageid'];

if(file_exists("{$Page}.php")){
include("{$Page}.php");
} else {
include("home.php");
}
?>


This way any invalid URL constants will be ignored, and the home page will just show as default.

- Zero Tolerance
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply