Topic: Typo Blog - Paginate?

I am using the current Trunk version # 1055 of Typo. One of the ways that I'm learning RoR is that I've begun creating my own theme for my Typo blog. Which during this development of my new theme, I am just working locally on my laptop, before I upload it to a live server when completed. I am using the Hemingway theme as my starting point & editing the files to make the theme look the way I want.

My general issue & reason for my question for help is that instead of a traditional blog that shows the entire blog on the home page, I want to only show the most recent blog on the home page and this entry will have a maximum number of characters & say "Read More" (which of course would link to the main blog page) if it goes beyond that. Then the main navigation of the site will have a link to a separate blog page, witch will have the entire blog. Plus, I'm hoping to also show the titles-only of the 2nd, 3rd & 4th most recent blog entries on the home page as well. An example of the general layout is http://orderedlist.com/

Also, I do not want to use the Admin page within Typo & just create the Pages code within the database... I want to create all this within the file structure of my Theme directory. Although I am willing to edit some files outside of the Theme directory as needed

Re: Typo Blog - Paginate?

Hehe, PunBB seems to have some trouble displaying this code (at least in firefox).  Thanks for posting it though, always better to get to see the actual code.

I think it might be as easy as changine the article controller's index method.  Change the line that says:

paginate(:article, :per_page => this_blog.limit_article_display,

and make it read
paginate(:article, :per_page => 1,

Hope that works!

Re: Typo Blog - Paginate?

Yes, I see Firefox displays it over your reply... but IE displays it clearly... too bad...

But anyways... yes, your suggestion did the trick... I am displaying only the latest entry now on the home page, while all of them on my Blog page. For such a simple change, I feel a little silly... but thanks!

So I know that I need to do some more research on my own... I still need to figure out how to display the 2nd, 3rd & 4th newest articles(posts) on the home page as well, besides just the 1st(newest)... the 2nd, 3rd & 4th will be just their titles only instead of the entire entry... Any tips on that?
Thanks again.

Re: Typo Blog - Paginate?

Sorry guys, that was a CSS issue that we've now fixed yikes

vinnie - rails forum admin

Re: Typo Blog - Paginate?

Sweet... looks good now in both IE & Firefox on my Windows PC. I haven't been to too many forums, but I really like the design of this one, better then most all others I've seen. Nice work!! One thing though... after I posted my question, I wanted to try & edit it to correct the issue... but I didn't see where I could edit my own post?

Re: Typo Blog - Paginate?

there should be a link that says edit at the bottom right of your post.  if you can't find it just do 'ctrl + F' and type in 'edit' and it should find it for you.

Re: Typo Blog - Paginate?

Oh, sure... there it is!!! Duh. Thanks.

I'm going to blame how before the CSS fix, my "code" covered the reply below, also covered those buttons as well wink

Re: Typo Blog - Paginate?

twist-throttle wrote:

I haven't been to too many forums, but I really like the design of this one, better then most all others I've seen. Nice work!!

Thanks!  I rather like it myself. wink  It was skinned by Kelli Shaver: www.kellishaver.com smile

Josh Catone helps run this place
Rails Forum - Rails Jobs

Re: Typo Blog - Paginate?

I still need to figure out how to display the 2nd, 3rd & 4th newest articles(posts) on the home page as well, besides just the 1st (newest blog entry)... But the 2nd, 3rd & 4th will ONLY be their Titles, instead of the entire post entry... Any tips on that?
Thanks again.

Re: Typo Blog - Paginate?

twist-throttle wrote:

I still need to figure out how to display the 2nd, 3rd & 4th newest articles(posts) on the home page as well, besides just the 1st (newest blog entry)... But the 2nd, 3rd & 4th will ONLY be their Titles, instead of the entire post entry... Any tips on that?
Thanks again.

Hmmm, that's an interesting idea. I think the way I'd do it is to get all four in the controller

paginate(:article, :per_page => 4,

and then manage the display of them in the view:
<%= render :partial => 'article_full', :object => @articles.shift %>
<%= render :partial => 'article_title', :collection => @articles %>

Array.shift returns the first element of an array and removes that element from the array - so after @articles.shift is run @articles.length is 3.
When you pass an :object to a partial it turns it into a variable named after the partial (so 'article_full' will be the variable containing the first article).   When you pass a :collection to a partial it loops through the partial sending each element of the array as an :object.

Hope this works out!