Log in

View Full Version : Weird code... An array never gets populated, yet it exists in the final HTML


akanevsky
11-08-2005, 05:03 PM
showthread.php, code:

require_once(DIR . '/includes/functions_editor.php');

$vBeditJs = construct_editor_js_arrays();
eval('$vBeditTemplate[\'clientscript\'] = "' . fetch_template('editor_clientscript') . '";');

Template editor_clientscript contains $vBeditJs[smilie_options_array]... Yet, the only place where $vBeditJs[smilie_options_array] ever gets populated is within the construct_edit_toolbar function, which never gets called on that page (or at least not according to the structure of the if clause)....

If I var_dump($vBeditTemplate['clientscript']), it has this:
var smilieoptions = new Array(); smilieoptions = { };

Yet in the final page:
var smilieoptions = new Array(); smilieoptions = {
'Generic Smilies' : {
'16' : new Array('http://www.site.com/interactive/images/smilies/smile.gif', '[smile]', 'Smile'),
'13' : new Array('http://www.site.com/interactive/images/smilies/icon_cheesygrin.gif', '[grin]', 'Cheesy Grin'),
'18' : new Array('http://www.site.com/interactive/images/smilies/icon_sad.gif', '[sad]', 'Sad'),
'35' : new Array('http://www.site.com/interactive/images/smilies/icon_wink.gif', '[wink]', 'Wink'),
'21' : new Array('http://www.site.com/interactive/images/smilies/icon_eek.gif', '[shock]', 'Shocked'),
'28' : new Array('http://www.site.com/interactive/images/smilies/icon_razz.gif', '[razz]', 'Razz'),
'22' : new Array('http://www.site.com/interactive/images/smilies/icon_confused.gif', '[confused]', 'Confused'),
'30' : new Array('http://www.site.com/interactive/images/smilies/icon_redface.gif', '[oops]', 'Embarassed'),
'27' : new Array('http://www.site.com/interactive/images/smilies/icon_mad.gif', '[mad]', 'Mad'),
'49' : new Array('http://www.site.com/interactive/images/smilies/sick.gif', '[sick]', 'Sick'),
'more' : 'Show all Smilies'
} };

Any suggestions as of where it gets populated?

Marco van Herwaarden
11-09-2005, 01:22 PM
It probably gets loaded from the datastore somehow in a dynamic way

akanevsky
11-09-2005, 11:35 PM
"somehow in a dynamic way"
thx, that's very helpful
not really