Welcome Guest, Not a member yet? Register   Sign In
Set Post active by current date?
#1

[eluser]Zimooon[/eluser]
Hey guys,

I want to set my calender entries offline when the current date/time > the datetime i set for the end of it. At the moment my entries can be manually set activ or not.
Here is my current code:

Model:
Code:
function getactiveCalender($active = FALSE) {
    if($active = TRUE)
    {
     $this->db->where('active',1);
    }
    $query = $this->db->get('calender');
    $calender = array();

    foreach ($query->result() as $row) {
        $posts[] = array(
            'id' => $row->id,
            'ctitle' => $row->ctitle,
            'ccontent' => $row->ccontent,
            'start' => $row->start,
            'end' => $row->end,
            'active' => $row->active
                    
        );
    }

    return $calender;

}

Something like
$now = time();
if $now > $end {
etc?

Best option would be to set active == 0 by now>end else active == 1 or stuff like that.


Thanks for help

Best regards


Messages In This Thread
Set Post active by current date? - by El Forum - 04-26-2011, 01:39 AM
Set Post active by current date? - by El Forum - 04-26-2011, 02:05 AM
Set Post active by current date? - by El Forum - 04-26-2011, 02:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB