[SOLVED] Menu question - prety URL's and parent link

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
sailor
Forum Members
Forum Members
Posts: 26
Joined: Fri Feb 06, 2009 9:16 pm

[SOLVED] Menu question - prety URL's and parent link

Post by sailor »

Ahoy!

CMSMS 1.5.2, Menu Manager 1.5.3

I'm struggling with getting this to work and was hoping for some help...

I am setting up mini "location sites" under a main parent site and am working on a menu for the location sites that I would like to remain dynamic for each location, I want the first 2 menu items to be links to the given "locations" main page and the main site home page. The main site home page link was easy, I just put the below list item inside the UL in the menu template...

Code: Select all

<li><a href="http://{$smarty.server.SERVER_NAME}"><dfn>1: </dfn>Global Home</a></li>
To make the link to the location home page is a little trickier and this is where I am stuck, I tried echo dirname($_SERVER['PHP_SELF']) but it just returns a "/", I'm pretty sure this is because I am using pretty URLs with mod_rewrite, so while I can use the "directory" name to call the page like http://somesite.com/localpage/ from a web browser the directory does not actually exist so PHP's dirname() won’t work. I know I could use includeprefix="" in the menu template, but with a lot of locations it would require a unique menu and page template for each location and I would like to avoid this.

Any thoughts on how to get this to work??
Last edited by sailor on Sat Feb 14, 2009 3:06 am, edited 1 time in total.
May the wind allways be on your back, and the sun allways on your face.
sailor
Forum Members
Forum Members
Posts: 26
Joined: Fri Feb 06, 2009 9:16 pm

Re: Menu question - prety URL's and parent link

Post by sailor »

OK, got it. This little snipplet of php puts the dir's from the global variable request_uri into an array, as the location pages only go one level deep, and are all called from a top level page all I need is [1] from the array, the php snipplet looks like this:

Code: Select all

{php}
$dir_structure = explode("/", $_SERVER[REQUEST_URI]);
echo $dir_structure[1]; 
{/php}
so my LI to make the link to the location home page in the menu looks like:
Local Home
Thanks to all who looked and thought about helping  ;D
Last edited by sailor on Sat Feb 14, 2009 3:11 am, edited 1 time in total.
May the wind allways be on your back, and the sun allways on your face.
Post Reply

Return to “CMSMS Core”