Page 1 of 1
[SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Wed Sep 26, 2007 12:38 pm
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.
Re: How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Thu Sep 27, 2007 1:43 pm
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")
Re: How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Thu Sep 27, 2007 1:52 pm
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
Re: How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Thu Sep 27, 2007 2:03 pm
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.
Re: How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Thu Sep 27, 2007 2:21 pm
by applejack
Alby
P.S. OK I have manged to sort it out. Thanks for your help.
Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Tue May 27, 2008 11:58 am
by nvdv
Dear Applejack or others,
Could you please elaborate a bit more about how you have solved this issue?
thx Niels
Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Tue May 27, 2008 6:50 pm
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.
Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Wed Jun 04, 2008 12:59 pm
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.
Re: [SOLVED] How To Change Menu Manager To Write Links As Relative URL's ?
Posted: Thu Jul 03, 2008 2:21 pm
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