Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Content Editor Discussions /

Forum for content editors and CMS users.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

sitetree_link shortcut return wrong link (SS 2.4)


Go to End


1818 Views

Avatar
vovanbo

Community Member, 3 Posts

19 June 2010 at 10:27pm

Edited: 19/06/2010 10:33pm

My base url is "http://192.168.1.1/silverstripe/". Site tree looks like this:

home (id=1)
--- good (id=2)
------ article1 (id=4)
------ article2 (id=5)
--- bad (id=3)
------ article1 (id=6)
------ article2 (id=7)

When i use sitetree_link id=4 on page "good", SilverStripe return link with href="/silverstripe/home/good/article1". But it's wrong, because expected href is "/home/good/article1", or even "http://192.168.1.1/silverstripe/home/good/article1".

On now moment i have next situation. I need to get complete url in javascript using jQuery. But in this code:

var completeURL = jQuery('base').attr('href') + page;

where 'page' is href of current link (ex. '/silverstripe/home/good/article1'), variable completeURL take value 'http://192.168.1.1/silverstripe//silverstripe/home/good/article1/'.

Can anybody help me to solve a riddle? :-)

Thanks in advance.