function giaoduc() { redirect('/'); if (isset($_REQUEST['id'])) { $data['popup'] = "hide"; $url = $_REQUEST['id']; } else { $data['popup'] = "show"; $url = "http://www.giaoduc.edu.vn/"; } $indexpage = "?giaoduc"; $this->initiate_news($url, $indexpage); $this->converturl($url, $base); $content = ''; $this->start_transfer("www.giaoduc.edu.vn"); $this->getcontent($content); if (substr_count($url, "/") == 3) { // index page preg_match_all('@<div id="r1" class="bodymiddle">(.*?)<div id="p3" class="bodycenter-cols">@s', $content, $matches, PREG_SET_ORDER); $content = ''; foreach ($matches as $match) { $content .= '<div id="r1" class="bodymiddle">' . $match[1] . '<div id="p3" class="bodycenter-cols">'; } $content = preg_replace('@<div id="p3" class="bodycenter-cols">@s', '</div>', $content); // ---------------------------------------- } elseif (substr_count($url, "/") > 4) { // article preg_match_all('@_UpdatePanel1">(.*?)<div id="searchbydate">@s', $content, $matches1, PREG_SET_ORDER); $content = ''; foreach ($matches1 as $match) { $content .= '_UpdatePanel1">' . $match[1] . '<div id="searchbydate">'; } $content = preg_replace('@_UpdatePanel1">@s', '', $content); $content = preg_replace('@<div id="searchbydate">@s', '</div>', $content); // ---------------------------------------- } else { // channel preg_match_all('@_UpdatePanel1">(.*?)<div id="searchbydate">@s', $content, $matches, PREG_SET_ORDER); $content = ''; foreach ($matches as $match) { $content .= '_UpdatePanel1">' . $match[1] . '<div id="searchbydate">'; } $content = preg_replace('@_UpdatePanel1">@s', '', $content); $content = preg_replace('@<div id="searchbydate">@s', '</div>', $content); } $content = str_replace('<img', '<img alt="Đọc báo Giáo Dục Online" ', $content); // ---------------------------------------- $this->updatecontent($content); $this->modify_urls(); $this->getcontent($content); $data['content'] = $content; $this->load->view('/news/giaoduc', $data); $header = new header(); $header->news("Báo Giáo Dục TP Hồ Chí Minh"); }