Loading Different Page Content Without Query Strings

2 posts by 2 authors in: Forums > CMS Builder
Last Post: September 5, 2013   (RSS)

Hello, All

In the past I've always relied on query strings to load page templates and content. In my latest CMSB deployment, however, such methods will not work so I am trying to find a sightly different approach.

I want to load the page template and content based on the php page/file name.

For example, if the URL is:

http://www.mysite.com/about.php

Then I can use the following code to work out the file name:

 $path = $_SERVER["SCRIPT_NAME"];
$file = basename($path); //$file is set to "about.php"


I could now use various "if" constructs to match the $file and load the required content.

Is this the right approach? What would be the best way of achieving this in terms of the lowest overhead?

:0/

Perchpole