I've been trying to pass a field value to javascript for the last 3
days with no avail.

First of all on my development pc I have php5. On my test/productin
server php4.

I put in the controller view function:

$tracks = $this->Track->find(
        'all',
        array(
                'conditions'=>array('Track.path_id' => $id,
                'contain' => array('Track.gpstrack')
                )
        );
$this->set(compact('tracks'));

//Track.gpstrack contains a GML file (something like Gmaps KML files)

In the view.ctp file:
$tmp= "var phptracks=".$javascript->object($tracks);
echo $javascript->codeBlock($tmp);

On my pc this works perfectly.
On the test server $javascript->object formats the $tracks array in a
different way. There's a different number of escape backslashes and
the javascript variable phptracks isn't even initialised. FF and
firebug error log report: "missing } after property list".
I suppose this has something to do with encode_json() function missing
in php4 but I don't understand why there's such difference in escaping
the field value. I mean the variable seems to be formatted almost
perfectly for javascript, why those missing backslashes in php4? Is it
wrong or incomplete cakephp code?
Should I implement an encode_json() function for php4? Should I code
this in a completely different way?

Thank you
    maxx

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to