summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-11 18:53:54 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-11 18:53:54 +0000
commitf3d40c02ecdf061a21e877e03e6c91d9b6c4b2c9 (patch)
tree094b5823006f568e09ec1928fc2ad2d7f9dddd08
parentf5b63e5261649ae078fea15ddbc8833035a19983 (diff)
A a script block to the <head> of the page that creates a javascript variable (base_url) such that javascript on the page can find the base url of the site in order to generate ajax callbacks.
-rw-r--r--core/helpers/core_block.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php
index 45cc2026..d3c61fa8 100644
--- a/core/helpers/core_block.php
+++ b/core/helpers/core_block.php
@@ -20,7 +20,10 @@
class core_block_Core {
public static function head($theme) {
- return '<script src="' . url::file("core/js/menu.js") . '" type="text/javascript"></script>';
+ $url = url::base(true);
+ $head[] = "<script>var base_url = \"$url\";</script>";
+ $head[] = '<script src="' . url::file("core/js/menu.js") . '" type="text/javascript"></script>';
+ return implode("\n", $head);
}
public static function page_bottom($theme) {