Page-Include script doesnt work
Posted by: Douwe Hoogeveen (---.direct-adsl.nl)
Date: January 04, 2006 11:10AM

Hello,

I have a problem with including pages using the next script:
if($page == ""winking smiley
{
include("home.php"winking smiley;
}
else
{
if(file_exists("$page.php"winking smiley)
{
include("$page.php"winking smiley;
}
else
{
include("404.php"winking smiley;
}
}
when I browse the index.php for the first time he includes the home.php file without any problem. But when I click on a link wich defines the include variable $page it refuses to work and uses the default page because he thinks its an empty variable.

Does anyone have a solution!? Or is there somthing I have to change in a configfile?

With kind regards,

Douwe Hoogeveen
Netherlands


Options: ReplyQuote
Re: Page-Include script doesnt work
Posted by: Jeroen (---.dsl.speedlinq.nl)
Date: January 04, 2006 12:16PM

You have an error in your php syntax, it should be something like this:

if($page == ""winking smiley
{
include("home.php"winking smiley;
}
else
{
if(file_exists($page.".php"winking smiley)
{
include($page.".php"winking smiley;
}
else
{
include("404.php"winking smiley;
}
}

Options: ReplyQuote
Re: Page-Include script doesnt work
Posted by: Douwe Hoogeveen (---.direct-adsl.nl)
Date: January 04, 2006 01:07PM

That isn't the problem!

When I echo the variable before using it in the script above, it will be empty! Eventhough I fill the variable with somthing, like for example: index.php?page=news

So it looks like that the variable isnt filled at all!

Can that be somekind of setting!?

Let me know plz....

gr. Douwe

Options: ReplyQuote
Re: Page-Include script doesnt work
Posted by: Port3M5 (---.cable.ubr01.jarr.blueyonder.co.uk)
Date: January 08, 2006 10:37PM

Post the whole code and i'll try and help

Options: ReplyQuote
Re: Page-Include script doesnt work
Posted by: shakes911 (---.scansafe.net)
Date: January 10, 2006 03:50PM

Does the link pass the value of $page via the querystring? If so you may need to use

if (file_exists($_GET['page'].".php"winking smiley {
etc
} else {
etc
}

Options: ReplyQuote


Sorry, only registered users may post in this forum.