Ahmed
Ahmed

Reputation: 7

Page creation dynamically codeigniter

I was working with a team recently for new website of a school & successfully completed. We had given him the admin panel where ever he want he can edit the pages or add images as he want & I used the tinymce editor. Now the client needs a new page but he wants to create a new page when ever needed is that is possible I don't know how to create that code because I am a new to php we used codeigniter 3.0. Because when he clicks on a single button it must create a controller and model and view for that page and a new table in database. Can any one help me out...

Upvotes: 1

Views: 1118

Answers (1)

Pupil
Pupil

Reputation: 23958

I think you are confused with what your client wants.

Your client wants a static CMS page (managed from admin panel).

So, Controller, Model and View are not mandatory.

Create a database table if you don't have pages.

And save page content, page title, meta and other stuff there.

Create a controller (for one time) named page or whatever you choose,

Create a function there, and show page from database.

eg. http://yoursite.com/page/show/aboutus

Now, it will call show() method from page controller and aboutus is an argument.

Fetch data from pages table with aboutus and show it.

You can rewrite routes with routes.php to make URLs look beautiful.

Upvotes: 3

Related Questions