Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

17480 Posts in 4474 Topics by 1973 members

Archive

SilverStripe Forums » Archive » sorting in the control Children

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

Page: 1
Go to End
Author Topic: sorting in the control Children 593 Views
  • grandsapin1673
    avatar
    Community Member
    7 posts

    sorting in the control Children Link to this post

    Hello,
    After reading tutorials and a few docs about data managment, I wonder if this is possible to sort data at template level, typicaly in the
    <% control Children %>
    tag.
    I realize that this would be a little agains MVC model...
    Many thanks,
    Eric

  • Sean
    avatar
    Core Development Team
    482 posts

    Re: sorting in the control Children Link to this post

    I'm not quite sure you can do that in the templates, at least I've never investigated far enough to do so. Is there any reason to go against the MVC model?

    You may, be able to do this, in your model class:

    function FilteredChildren($filter = 'ID DESC') {
    return DataObject::get('Page', "ParentID = {$this->ID}", $filter);
    }

    Then you could go:

    <% control FilteredChildren('Title DESC') %>

    If you leave the parameter out, it uses "ID DESC" - the default. However, I've not tested this, the templating system might not allow it.

    Cheers,
    Sean

    593 Views
Page: 1
Go to Top

Currently Online: entercow, _Vince

Welcome to our latest member: marcusl

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

Comments on this website? Please give feedback.