Recent Topics

Same day in history

Started by on Jul 27, 2008 – Contents updated: Jul 27, 2008

Jul 27, 2008 22:37    

I was trying to make a plugin that would show me posts that i made on the exact day in history.

I wanted this :
# 1 year ago (link to all posts from same day as now 1 year ago)
# 2 year ago (link to all posts from same day as now 2 year ago)
# 3 year ago (link to all posts from same day as now 3 year ago)
# 4 year ago (link to all posts from same day as now 4 year ago)
# 5 year ago: we wrote nothing
# 6 year ago (link to all posts from same day as now 6 year ago)
# 7 year ago: we wrote nothing

I managed to write the sql (I manage to get the exact result in phpmyadmin) but I'm not able to make it into an actual widget.

PHP

$sql "SELECT DISTINCT post_ID , post_title, post_urltitle
FROM T_items__item
WHERE DATE_FORMAT(T_items__item.post_datestart, '%m') = month(now()) 
AND   DATE_FORMAT(T_items__item.post_datestart, '%d') = day(now())     
AND   DATE_FORMAT(T_items__item.post_datestart, '%y') < year(now())    
ORDER BY T_items__item.post_datestart  DESC
LIMIT ".$params['history_posts_limit'];

I adapted ministats from Danny, I wrote it from scratch... nothing seems to work.

Can some of you wonderpeople manage this for me ?

Jul 28, 2008 12:32

See if this gets you started ;)

PHP

function SkinTag$params )
{
    global $Blog;
    $timestamp_min mysql2timestamp(  date'Y-m-d 00:00:00'strtotime'-1 year' ) ) );
    $timestamp_max mysql2timestamp(  date'Y-m-d 23:59:59'strtotime'-1 year' ) ) );
 
    $HistoryList = new ItemList2$Blog$timestamp_min$timestamp_max999999 );
    
    // do whatever you like with $HistoryList
}

¥


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.