[SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

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
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

[SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

Post by applejack »

Hi

I am trying to create mini sub sites with their own domain names which I have done using mod rewrite. In the template there is a base href with the sub sites domain name so that all content links which are relative work fine and keep the sub sites domain name in the browsers address bar. The problem is with the menu manager as it writes it's URL's as absolute and takes the root url from the config.php file which cannot be changed otherwise the system doesn't work.

Does anyone know the best way to overcome this presumably one can edit the way menu manager works so that it does not use absolute URL's but relative ones?

All and any help much appreciated.
Last edited by applejack on Thu Sep 27, 2007 2:53 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How To Change Menu Manager To Write Links As Relative URL's ?

Post by applejack »

Another option would be to do a pattern replace in the menu manager template something like below but I do not know how or where to write this correctly as I am not a PHP coder.

$node->url = str_replace('http://domain_name/',"'', "$node->url")

Website Design & Production
http://www.applejack.co.uk
alby

Re: How To Change Menu Manager To Write Links As Relative URL's ?

Post by alby »

applejack wrote: Another option would be to do a pattern replace in the menu manager template something like below but I do not know how or where to write this correctly as I am not a PHP coder.

$node->url = str_replace('http://domain_name/',"'', "$node->url")
Try with:
{$node->url|replace:'http://domain_name/':''}

Alby
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How To Change Menu Manager To Write Links As Relative URL's ?

Post by applejack »

Hi Alby

Thanks, where do I write this in the menu manager template as it works in that it does strip out the domain name but shows up on the page as text.

Website Design & Production
http://www.applejack.co.uk
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How To Change Menu Manager To Write Links As Relative URL's ?

Post by applejack »

Alby

P.S. OK I have manged to sort it out. Thanks for your help.

Website Design & Production
http://www.applejack.co.uk
nvdv
New Member
New Member
Posts: 2
Joined: Tue May 27, 2008 11:28 am

Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

Post by nvdv »

Dear Applejack or others,

Could you please elaborate a bit more about how you have solved this issue?

thx Niels
Pierre M.

Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

Post by Pierre M. »

Hello,

it is a use of a Smarty operator in the menu template if I have understood well.
Smarty : Smarty doc.
Menu template : CMSms doc.
Hope it helps and is true :)

Pierre M.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

Post by applejack »

In the menu manger where it has href="{$node->url}" do href="{$node->url|replace:'http://domain_name/':''}" this will then replace the absolute URL i.e. the domain name with an empty string therefore giving you a relative URL.

Website Design & Production
http://www.applejack.co.uk
nvdv
New Member
New Member
Posts: 2
Joined: Tue May 27, 2008 11:28 am

Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?

Post by nvdv »

Thanks guys,

Strange but i changed the href="{$node->url}" to href="{$node->url|replace:'http://domain_name/':''}" but nothing happens  :-\ . I did it in my active menu template (simple_menu.tpl) is that ok?

Any help is very much appreciated..  :)

Cheers Niels
Post Reply

Return to “CMSMS Core”