Working with JSON and CouchCMS, this works as posted in forums:
If I take the json string:
Manually save it into a template editable text area via couch admin, then modifying the above code to work in <cms:pages> to repeat the functionality from DB but does not work.
What am I missing?
- Code: Select all
<cms:capture into='persons' is_json='1' >
[ { "firstname":"Marilyn", "lastname":"Monroe" } , { "firstname":"Abraham", "lastname":"Lincoln" } , { "firstname":"Christopher", "lastname":"Columbus" } ]
</cms:capture>
<cms:show persons as_json='1' /><br>
<cms:each persons as='person' >
<cms:show person.firstname /> <cms:show person.lastname /> <br />
</cms:each>
If I take the json string:
- Code: Select all
[ { "firstname":"Marilyn", "lastname":"Monroe" } , { "firstname":"Abraham", "lastname":"Lincoln" } , { "firstname":"Christopher", "lastname":"Columbus" } ]
Manually save it into a template editable text area via couch admin, then modifying the above code to work in <cms:pages> to repeat the functionality from DB but does not work.
- Code: Select all
<cms:pages masterpage='sample.php' id='554' >
<!-- shows string correctly -->
<cms:show json_string />
<cms:capture into='persons' is_json='1' ><cms:show json_string /></cms:capture>
<!-- this shows nothing -->
<cms:show persons as_json='1' /><br>
<cms:each persons as='person' >
<cms:show person.firstname /> <cms:show person.lastname /> <br />
</cms:each>
</cms:pages>
What am I missing?