i'm trying to add dynamic routes from database in CI. but my website is really slow after adding data into my table.
anyway to performed routes.php file? or anyway to speed up my site?
NOTE: i have more than 60,000 record for SEO friendly url.
routes affected my response server time, its about 4 seconds.
here is my code:
require_once(BASEPATH . 'database/DB' . EXT);
require_once(BASEPATH . 'helpers/url_helper' . EXT);
require_once(BASEPATH . 'helpers/text_helper' . EXT);
$db = &DB();
$query = $db->query('select id,title from news');
$result = $query->result();
foreach ($result as $row) {
$string = strtolower(str_replace(' ', '-', $row->title));
$route["funny-news/" . $string] = "news/newsDetails/$row->id";
}
Thanks.
EDIT:
newsDetails Controller code:
public function newsDetails($id)
{
$hdata['active'] = "news";
$result['news'] = $this->mytestdb->getNewsById($id);
$this->load->view('nheader', $hdata);
$this->load->view('newsDetails', $result);
$this->load->view('footer');
}