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
#2

[eluser]toopay[/eluser]
Hey, i wonder members here would help you more, if you post your thread to another section. Because this section mention : "NO CODE".
#3

[eluser]Zimooon[/eluser]
Oh excuse me Sad I have some probs posting in the other section ( up to 20 times after the post really is posted) .




Theme © iAndrew 2016 - Forum software by © MyBB