Integration of PHP into JavaScript to take value from Backend -
so trying take input value backend(cms wordpress, mine custom developed cms) , display value in javascript code.
taking values backend code:
<?php $effects_array=array( "slicedown","slicedownleft", "sliceup", "sliceupleft","sliceupdown","sliceupdownleft", "fold","fade","random","slideinright", "slideinleft","boxrandom","boxrain","boxrainreverse", "boxraingrow","boxraingrowreverse"); foreach ($effects_array $effects_key => $effect_value) { ?> <label class="inline"><input type="radio" value="<?php echo $effect_value ?>" class="input-xxlarge" name="theme_options[effects_select]" <?php if (isset($site['tmp']['datalist']->effects_select)){ ?> checked <?php } ?> ><?php echo $effect_value ?></label> <?php } ?>
the code trying integrate:
$(window).ready(function() { $('#slider').nivoslider({ effect: '<?php echo $site['theme_options']['effects_select']->$effects_value ?>',
i need have values effects_array effect
this error when inspect element
$(window).ready(function() { $('#slider').nivoslider({ effect: '<br /> <b>fatal error</b>: cannot use object of type stdclass array in <b>c:\xampp\htdocs\limetraycms\themes\amalfi_latest\home.tpl.php</b> on line <b>135</b><br />
one of $site['theme_options']['effects_select']
not array object. print_r($site) see type is. or try 1 of:
- $site->theme_options['effects_select']
- $site['theme_options']->effects_select
- $site->theme_options->effects_select
to see if error goes away 1 of them.
Comments
Post a Comment