Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

How to only display unique dates in my blog

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
danosirra
Smarty n00b


Joined: 29 Oct 2006
Posts: 1

PostPosted: Sun Oct 29, 2006 3:29 pm    Post subject: How to only display unique dates in my blog Reply with quote

Hi all,

I want to have it so that the date appears before the blog entry, and, say, all three blog entries for that date appear after one another (without the date repeating).

I'm quite new to all this CSS and Smarty stuff, so forgive me (and be gentle). My site is www.osirra.com if that helps. For example, I have the date 25 October repeated a few times.

Not sure how to change my post.template to do this.

Can anyone help?

Dan.
Back to top
View user's profile Send private message Visit poster's website
Hielke Hoeve
Smarty Elite


Joined: 06 Jan 2006
Posts: 406
Location: Netherlands

PostPosted: Mon Oct 30, 2006 9:31 am    Post subject: Reply with quote

You could make triple arrays in php. The outer array for the date and the inners for the items. So that you would have:

Code:
Array {
  "29 October 2006" => Array {
      1 => Array { title = "foo", content => "bar" } },
  "25 October 2006" => Array {
      1 => Array { title = "foo", content => "bar" },
      2 => Array { title = "foo", content => "bar" } }
}


It might look a bit odd but for smarty coders quite easy to maintain. It's annoying to place if elses all over the tpl file.
_________________
Debug XHTML Compliance
SmartyPaginate
Smarty License Questions
---
(About Unix) The learning curve is full of aha! moments, such as that glorious day that the full beauty of grep and, later, find is revealed in all its majesty. --- Robert Uhl <ruhl@4dv.net>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP