Code: Select all
if(isset($_SERVER['PHP_SELF']))
{
// Pop the last elememt of array $_SERVER[]
$content_id = array_pop(explode("/", $_SERVER['PHP_SELF']));
// The following lines of code helps determines if current request is a page or section
$check_type = explode(".", $content_id);
// Check if it has an html extension
if($check_type[1] != 'html')
$request->setSectionContent($content_id);
else
$request->setPageContent($check_type[0]);
}
After this line of code:
$content_id = array_pop(explode("/", $_SERVER['PHP_SELF']));
the value of $content_id will be "about-us". Ok the code works fine but the problem is external javascript files and stylesheets are not loading properly so the contents of the page are messed up. But I don't see any php error messges.
Is it because from PHP perspective http://localhost/pages.php/about-us is not a valid url. When I use http://localhost/pages.php?sectionid=about-us all the external stylesheets and js files are loaded successfully so the page looks fine....