GetRow('SELECT *, DATEDIFF(NOW(), news_datefrom) as daysold FROM news LEFT JOIN contacts ON news_c_id = c_id WHERE news_id = "' . $news_id . '" GROUP BY news_id'); }else { $new = $db->GetRow('SELECT *, DATEDIFF(NOW(), news_datefrom) as daysold FROM news LEFT JOIN contacts ON news_c_id = c_id WHERE news_active = 1 AND (news_dateto > NOW() OR news_dateto = "0000-00-00") AND (news_datefrom <= NOW()) AND news_id = "' . $news_id . '" GROUP BY news_id'); } $temp = @explode(",",$new['news_cat']); if (is_array($temp)){ foreach ($temp as $cat){ $cats[$cat] = $cat; } } if (!$new['news_active']){ header("Location:http://www.dioceseofnorwich.org/news/not-found"); } if ($new['daysold'] < 0 ){ header("Location:http://www.dioceseofnorwich.org/news/calendar/event-ended"); } if (@$_GET['test']){ // print_r($cats); } if ($cats['38'] || $cats['33'] || $cats['37'] || $cats['54'] || $cats['50']){ $new['news_title'] = "Vacancy: ".$new['news_title']; $vac_title = true; $this->set('artCSS',"purple.css"); } if ($new['news_cat'] == 33 || $new['news_cat'] == 39 || $new['news_cat'] == 37 || $new['news_cat'] == 54 || $new['news_cat'] == 50){ if (!$vac_title) { $new['news_title'] = "Vacancy: ".$new['news_title']; $this->set('artCSS',"purple.css"); } } $pageTitle = $new['news_title'].""; // construct your pagetitle } $this->set('pageTitle', $pageTitle); //make your variable available to your view $db = Loader::db(null, null, null, null, true); } } Article (Diocese of Norwich)