I have a jQuery carousel that uses JSON data. My shopping cart gives me little info tags like this:
<?php ProductName(); ?>
I want to put those PHP info tags in the JSON data, so that the carousel is dynamically generated from my database.
How do I get the tags into the data file?
Try this http://php.net/json_encode
The best way to do that is to create the JSON data using a PHP script that builds a multidimensional array (which has the same structure as the json you want to output) and JSON encode it:
<?php
// make this reflect your jsons structure
$data = array(
"your" => array(
"stuff-a" => "foo",
"stuff-b" => ProductName()
)
);
echo json_encode($data);
?>
Then you can use that script as your data source.