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?
php template problems
Moderator: General Moderators
Re: php template problems
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
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