Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Get latest blog entries from BlogTree sections

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 1234 Views
  • sajok
    Avatar
    Community Member
    82 Posts

    Get latest blog entries from BlogTree sections Link to this post

    Hello,

    I have subclassed my website into small sections (BlogHolders) and big sections which include other blogHolders (BlogTree). I have an horizontal accordion showcase on homepage to show the latest four news entries, and each entry is from a specific blog holder or blog tree.

    This is the structure of my website:

    1. Home

    2. Politics => BogHolder

    3. Economie => BlogHolder

    4. Culture => BlogTree

    a. Local =>BlogHolder
    b. Regional =>BlogHolder
    c. Nationa =>BlogHolder

    5. Sports => BlogTree

    a. Local =>BlogHolder
    b. Regional =>BlogHolder
    c. Nationa =>BlogHolder
    ...

    I tried something like the following to show the latest entry from a BlogTree but it doesn't work:

    function LatestNews($title) {
    $news = DataObject::get_one('BlogTree', "URLSegment = '$title'");
    return ($news) ? DataObject::get("BlogEntry", "ParentID = $news->ID", "Date DESC", "", 1) : false;
    }

    Any help on how can I get news from this structure?

    thanks

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