Problem with perch_collection raw output

  • 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.


  • drewm

    Approved the thread.
  • Rather than skipping the template and returning raw, you can just make a perch template to output the XML.

    Haven't seen your template but here is a best guess for a possible solution

  • Hi Guys,

    Thanks for this. I've taken your advice and output the collection as xml which is working fine. However I still need to get the lat and lng values from the map which are only available if you return as raw.

    I've amended the collection code to include an each function to get each items set of lat/lng values but when you set them as variables to pass into the template it just returns the first items values everytime. Ive checked with perch:showall and they definitely show up correct for each item but just not setting as vars properly.

    I've tried looping through them with another each function and a foreach but can't get it to work properly. Am I missing something obvious?