Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

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

Blog entries on main homepage.


Reply


23 Posts   6276 Views

Avatar
qlex

Community Member, 68 Posts

3 June 2009 at 7:53am

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

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

i hope this helps!
qlex

Avatar
George

Community Member, 41 Posts

4 June 2009 at 8:29am

thaaanks!!!

Avatar
sleeper

Community Member, 6 Posts

16 July 2009 at 12:16am

Edited: 16/07/2009 12:23am

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.

Avatar
Fuzz10

Community Member, 787 Posts

16 July 2009 at 12:27am

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 !

Avatar
sleeper

Community Member, 6 Posts

16 July 2009 at 1:07am

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?

Avatar
Fuzz10

Community Member, 787 Posts

16 July 2009 at 1:22am

Edited: 16/07/2009 1:23am

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

Avatar
sleeper

Community Member, 6 Posts

16 July 2009 at 1:46am

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

Avatar
Fuzz10

Community Member, 787 Posts

16 July 2009 at 7:40pm

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 %>