Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Outputting a simple array

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1474 Views
  • sarahk
    Avatar
    Community Member
    46 Posts

    Outputting a simple array Link to this post

    I have an array which is basically

    $output = array('oranges','apples','lemons');

    but the list will change over time and it's needed for a quick visual audit. The query is actually doing a distinct so it doesn't relate to any particular object.

    In my controller I have a function called SummaryList and it can output the array.

    To get that array to be accessible in my template, however the array needs to be wrapped in ArrayData but that doesn't work because the array isn't associative.

    What is the best way of outputting this so that I can loop through the array and what is the right template syntax?

  • sarahk
    Avatar
    Community Member
    46 Posts

    Re: Outputting a simple array Link to this post

    Thanks to the IRC crowd I got this sorted using DataObjectSet

    1474 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.