Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Blog entries on main homepage.

Discuss the Blog Module.

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

Page: 1 2 3
Go to End
Author Topic: 6190 Views
  • qlex
    Avatar
    Community Member
    68 Posts

    Re: Blog entries on main homepage. Link to this post

    George,
    woohoo, it will be probably my first helping opportunity !

    check my post which solved your problem here:
    http://silverstripe.org/blog-module-forum/show/261584?start=0#post261590

    i hope this helps!
    qlex

  • George
    Avatar
    Community Member
    41 Posts

    Re: Blog entries on main homepage. Link to this post

    thaaanks!!!

  • sleeper
    Avatar
    Community Member
    6 Posts

    Re: Blog entries on main homepage. Link to this post

    Hi all,

    I'm currently evaluating SS against Modx and I've been trying to display the latest 4/5 blog posts in the side bar of the main template and found this thread. Using Fuzz10's code, what where and how do you paste this, i seem to be able to figure this stuff out in Modx but not in SS, but the blog module is so good i don't want to give up. Im uisng the blackcandy template and have the blog module installed

    Any help appreciated.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Blog entries on main homepage. Link to this post

    The example code needs to be placed in its own method in the relevant page-controller class. Then , the code can be called from your template.

    I advise going through the tutorials on this site to get a feel for the core principles of Silverstripe and the MVC pattern.

    good luck !

  • sleeper
    Avatar
    Community Member
    6 Posts

    Re: Blog entries on main homepage. Link to this post

    Thanks Fuzz10,

    Firstly great site you have (im assuming it's SS powered), i see you have the latest blog/news display that im trying to acheive, so if anyone is capable of giving advice on this it would be you, so i do appreciate your taking the time to reply.

    That said, i find myself getting quite frustrated with the tutorials as they seem to be targetted at programmers or certainly the more code programmer orientated. I seem to be able to acheive results a lot quicker in Modx and im getting frustrated at that too, because for some reason i think i want to work with SS when all logic says use Modx.

    MrHyde has a great post, but does not seem to work for me, i know it's cheeky but if someone has a paste this into this and do that mini guide it would be very helpful and certainly make the tutorials easier to understand when i cross reference what i did with the tutorial as even after 3-4 hours of reading and re-reading them, it seems very hard to apply them to the base install.

    Is it just me or do others struggle with this first time round?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Blog entries on main homepage. Link to this post

    Thanks for the compliment. ;)

    Well, I agree that starting out with Silverstripe is a lot easier for coders because of the chosen (IMHO beautiful) architecture. Believe me, it is well worth the initial effort.

    As to your question ; basically :

    1> Add to your HomePage_Controller class :

       function MyBlogEntries($limit = 10) {
          $BlogEntries = DataObject::get_one("BlogHolder");
          return ($BlogEntries) ? DataObject::get("BlogEntry", "ParentID = $BlogEntries->ID", "Date DESC", "", $limit) : false;
       }

    2> In you homepage template :

    <% control MyBlogEntries %>            
    $Title , $Link $Summary or whatever blog-fields / methods you would like to use.

    or , try <% include BlogSummary %> , don't know whether or not this still works with the most recent version of the blog-module though
    <% end_control %>

    Et voila...

  • sleeper
    Avatar
    Community Member
    6 Posts

    Re: Blog entries on main homepage. Link to this post

    See, it makes so much more sense when it's explained person to person, thank you so much Fuzz10. This is much more like im used to, but this is not made clear in the tutorials. Im not going to complain because you've now made me very happy.

    I'll be quite honest Fuzz10 it was your site and perhaps one other than made me decide to try SS in the first place. Im always worried about using CMS because of the idea that it may take away design freedom, clearly thats not the case

    Im trying to bunch together the database references, to display Tags (or the frist 2 or three), i've managed to get the references for author and commetns count from the BlogEntry and summary files, but Tags i cant seem to get to work

    So far i have:

    $Date.Nice
    $Content.FirstParagraph
    $Author
    $Comments.Count

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Blog entries on main homepage. Link to this post

    Sleeper :

    For all fields / variables and methods you can use , have a look at the templates that came with the blog-module , especially the BlogSummarry.ss. ...

    To display Tags :
    <% control TagsCollection %>
    <a href="$Link" title="View all posts tagged '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
    <% end_control %>

    6190 Views
Page: 1 2 3
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.