Page 1 of 1

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

Posted: Fri Feb 13, 2009 8:57 pm
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??

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

Posted: Sat Feb 14, 2009 3:06 am
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