[geeklog-cvs] geeklog: Created GeeklogConfig object that JavaScript can access...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Mar 19 19:20:58 EDT 2011
changeset 8189:1b12a4548aa2
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/1b12a4548aa2
user: Tom <websitemaster at cogeco.net>
date: Sat Mar 19 19:20:34 2011 -0400
description:
Created GeeklogConfig object that JavaScript can access if needed
diffstat:
system/classes/scripts.class.php | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (30 lines):
diff -r 72e239d6633b -r 1b12a4548aa2 system/classes/scripts.class.php
--- a/system/classes/scripts.class.php Sat Mar 19 22:47:17 2011 +0100
+++ b/system/classes/scripts.class.php Sat Mar 19 19:20:34 2011 -0400
@@ -414,16 +414,21 @@
if ($this->javascript_set) {
// Add Core JavaScript global variables
$footercode = '<script type="text/javascript">' . LB;
- $footercode .= "var geeklogSiteUrl = '" . $_CONF['site_url'] . "';" . LB;
- $footercode .= "var geeklogLayoutUrl = '" . $_CONF['layout_url'] . "';" . LB;
- $footercode .= "var geeklogAdminUrl = '" . $_CONF['site_admin_url'] . "';" . LB;
- $footercode .= "var geeklogThemeName = '" . $_CONF['theme'] . "';" . LB;
if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
$footercode .= "var geeklogEditorBaseUrl = '" . $_CONF['site_url'] . "';" . LB;
}
+ // Create config variable array to pass to JavaScript
+ $config_js = array();
+ $keys = array('site_url', 'site_admin_url', 'layout_url', 'path', 'path_html', 'path_layout',
+ 'site_name', 'site_slogan',
+ 'theme', 'doctype', 'path_themes');
+ foreach($keys as $key){
+ $config_js[$key] = $_CONF[$key];
+ }
+ $footercode .= "var GeeklogConfig = new Object(" . json_encode($config_js) . ");" . LB;
$footercode .= '</script>' . LB;
- // Set JavaScript Library Files first incase other scripts need them
+ // Set JavaScript Library files first incase other scripts need them
if ($this->jquery_cdn) {
$footercode .= '<script type="text/javascript" src="' . $this->jquery_cdn_file . '"></script>' . LB;
$this->library_files['jquery']['load'] = false; // Set to false so not reloaded
More information about the geeklog-cvs
mailing list