The usage of $vars['url'] should be replaced by using elgg_get_site_url(). Got that.
But then there's also often used "echo $CONFIG->wwwroot" and replacing this by elgg_get_site_url() seems to fail for example in case of document.location.href='<?php echo $CONFIG->wwwroot"; ?>some/url'". In this case replacing "echo $CONFIG->wwwroot" by "echo elgg_get_config('wwwroot')" would be an alternative. But why does elgg_get_site_url() fails to work.
Also, I'm unsure what to use in calling actions via $.post().
Can anyone enlighten me, please?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- iionly@iionly
iionly - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.bump...
I've never had elgg_get_site_url() fail to work - under what circumstances does it fail? How does it fail?
Call actions using elgg.action
eg. https://github.com/AU-Landing-Project/au_sets/blob/master/views/default/au_sets/js.php#L190
This is a bit off topic but in your example you are using the site url in javascript. Instead of echoing it in with PHP you can use the equivalent javascript function:
Or even better:
@Matt: in case of document.location.href within JS code providing the url using elgg_get_site_url() failed each time I tried (for example for the profile manager plugin or within the faq plugin). $CONFIG->wwwroot or elgg_get_config('wwwroot') works though.
I've not yet tried using elgg.get_site_url() or elgg.normalize_url() instead (thanks for pointing that out, Juho). I guess it remains a matter of trial and error in each case then to find out what to use.