Hi,
I have a perch collection which contains a perch map that i'm using 'raw'=>true, to get the long and lat values to use as an XML feed to display on a map.
But I also have some categories in the collection that I need to get the title or slug to use on the page as well. But the raw option is changing the categories from their title/slugs to ID values.
Is there anyway to get both the long/lat values and the category names? Maybe using the 'each'=> function option?
I'll post my templates below.
Thanks!
PHP
- <?php
- header('Content-type: application/xml');
- include($_SERVER['DOCUMENT_ROOT'] . '/perch/runtime.php');
- $properties = perch_collection('Properties', array(
- 'skip-template'=>true,
- 'raw'=>true,
- ));
- $xml_out = '<?xml version="1.0" encoding="utf-8"?><markers>';
- foreach($properties as $loc) {
- $xml_out .= '
- <marker
- title="'. $loc['title'].'"
- loc="' . $loc['loc_title'].'"
- lat="' . $loc['map']['lat'].'"
- lng="' . $loc['map']['lng'].'"
- slug="' . $loc['propertyslug'].'"
- build="' . $loc['catBuild'].'"
- />';
- }
- $xml_out .= '</markers>';
- echo $xml_out;
- ?>