Changing JS/html href URLs on External Load

Claiver

Member
So I'm loading some parts of the XenForo header in my CakePHP application. The HTML is loaded fine, and I'm also including the xenforo.js for the base JS logic to ensure the visitor bar works (with messages and alerts).

Currently when it generates the HTML for the loaded templates, all of the URLs are relative. Since my board is located at http://mysite.com/community/, and my main page at http://mysite.com/, I need to somehow make the renderer/parser append "/community/" to the URLs.

In addition to that, the AJAX urls in the javascript are relative as well. So when it tries to load the alerts upon hovering over it, it tries to load it from http://mysite.com/account/alerts-popup/?&_xfRequestUri=%2F&_xfNoRedirect=1&_xfResponseType=json instead of http://mysite.com/community/account/alerts-popup/etc..

Any idea how I would best go about solving this matter? Cheers! :)
 
My best bet would be to modify the <BASE> tag to your forum path and use absolutes urls on your CakePHP application.
 
My best bet would be to modify the <BASE> tag to your forum path and use absolutes urls on your CakePHP application.
Unfortunately my own application is reliant on relative pathing. I was hoping XenForo used some sort of LinkHelper to create links, this is not the case?
 
Unfortunately my own application is reliant on relative pathing. I was hoping XenForo used some sort of LinkHelper to create links, this is not the case?

Yes, the link builder includes an option to build absolute paths but I'm not sure if you can create an addon or something else to make all urls within the forum to be absolute.
 
Yes, the link builder includes an option to build absolute paths but I'm not sure if you can create an addon or something else to make all urls within the forum to be absolute.
Ahh, so there isn't a global option I could set, before the linkbuilder does his job? For example during initialization:
PHP:
XenForo_LinkBuilder::path = '/community/'; // instead of '/'

// all the link-building code here
 
Ahh, so there isn't a global option I could set, before the linkbuilder does his job? For example during initialization:
PHP:
XenForo_LinkBuilder::path = '/community/'; // instead of '/'

// all the link-building code here

To be honest, I haven't dug deep enough in the link builder areas of XenForo, I'm not sure if everything goes through the same function. If that is the case, then I think you can make something like that. :)
 
Top Bottom