php template problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ozziepom
Forum Newbie
Posts: 1
Joined: Wed Apr 30, 2008 7:01 am

php template problems

Post by ozziepom »

I have recently been assigned to update a sporting club website. We have a php template building from headtag, sidetag etc. For years the all the pages displayed perfectly, now the following 'if else' and 'include' statement seems to be failing.

<?php
if(!$page) {
include("/home/name/public_html/content/xyznews.php");
}
else{
include("/home/name/public_html/content/" . "$page" . ".php");
}
?>

It seems OK to me, but beating my head over why 'xyznews.php' page keeps displaying when selecting other pages on the site. Or is this a problem with the hosting provider?
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

Re: php template problems

Post by N1gel »

The If looks ok.

If you want to know why it always shows xyznews.php try printing out $page before the if statment and see what it looks like. Your problem could be somewhere else in your code
Post Reply