PHP generate javascript objects with multiple properties -
i did function generates php array javascript object, instance
$this->routes = array( 'module' => array( 'route1' => $renderer->url('route1', array('lang' => $lang_short)), 'route2' => $renderer->url('route1', array('lang' => $lang_short)), ) );
my function generate javascript object
{static: {module: {route1: 'route1', route2: 'route2'}}}
so can access in js
static.module.route1
the "problem" method made handles arrays 2 nested arrays, not more. nice , easy way achieve this?
use native json_encode function, instead of custom function.
Comments
Post a Comment