I am trying to create dynamic pages without creating new files and getting the data from the database…
so my table will be like:
Pages
------
id | page_name | text
1 | about | about page goes here
2 | contact | contact page goes here
now my question is how can i manage to make $this->uri->segement(1) to automatically check if the given page name exist in database?
do i have to create a new controller that will handle all this or?
If you have several pages that you want to check, I would recommend having a Pages controller that managers those pages. Something like this
In your
routes.php, you route youraboutandcontactpages (and whatever others you may have) to the pages controller.Your
Pages_modelwill need a simple function that checks if the page name exists in the database.