Welcome Guest, Not a member yet? Register   Sign In
Question about calendar and database
#4

[eluser]opel[/eluser]
I have this in my model :

Code:
function calendarDates($year, $month)
    {
        $query = $this->db->query(" SELECT blog_id, blog_title, blog_posted FROM blog WHERE YEAR(blog_posted) = ".$year." AND MONTH(blog_posted) = ".$month." ORDER BY blog_posted ASC");
        
        $dates = array();
        
        foreach ($query->result_array() as $key => $value)
        {
            $dates[$key] = $value;
        }
        
        return $dates;
    }

And this in my controller :

Code:
//Get article dates
        $dates = $this->blog_model->calendarDates($year, $month);
        
        //Create array for calendar
        
        foreach ($dates as $article)
        {
            //$calendar_dates[date("d",strtotime($article['posted']))] = base_url()."blog/month/".date("Y",strtotime($article['posted']))."/".date("d",strtotime($article['posted']))."/";

            $calendar_dates[date("j",strtotime($article['blog_posted']))] = base_url()."blog/article/".url_title($article['blog_title'])."/".$article['blog_id']."/";

        }
        

        return $this->calendar->generate($year, $month, $calendar_dates);


Messages In This Thread
Question about calendar and database - by El Forum - 05-05-2009, 12:59 AM
Question about calendar and database - by El Forum - 05-05-2009, 01:41 AM
Question about calendar and database - by El Forum - 05-05-2009, 02:04 AM
Question about calendar and database - by El Forum - 05-05-2009, 03:00 AM
Question about calendar and database - by El Forum - 05-05-2009, 06:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB