Jump to:

3401 Posts in 979 Topics by 855 members

Template Questions

SilverStripe Forums » Template Questions » [solved] access has_many from template

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

Page: 1
Go to End
Author Topic: 1327 Views
  • madmaurice
    Avatar
    Community Member
    20 Posts

    [solved] access has_many from template Link to this post

    Im about to create a selfmade image gallery. i created a datamodel named GalleryImage.
    and added a "Title" to the static $db.

    I created a GalleryPage page type and added

    static $has_many = array("Images"=>"GalleryImage");

    to it.
    Then i ran /dev/build?flush=1
    and altough ive added some GalleryImages to it and inserted

    <% control Images %>
    $Title <br>
    <% end_control %>

    inside my GalleryPage.ss file no Title of the Images shows.

    edit:

    GalleryPage.php : http://pastie.org/719094
    GalleryPage.ss : http://pastie.org/719095
    GalleryImage.php : http://pastie.org/719098

  • madmaurice
    Avatar
    Community Member
    20 Posts

    Re: [solved] access has_many from template Link to this post

    Damn it. got it...

    Forgot to check the checkbox left of the entry in the admin panel.....

    shame on me...

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