简体   繁体   English

页面创建动态codeigniter

[英]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. 我们给了他管理面板,他希望他可以根据需要编辑页面或添加图像,我使用了tinymce编辑器。 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. 现在客户端需要一个新页面,但他想在需要的时候创建一个新页面,这是可能的我不知道如何创建该代码,因为我是一个新的php我们使用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... 谁能帮我吗...

I think you are confused with what your client wants. 我认为你对你的客户想要的东西感到困惑。

Your client wants a static CMS page (managed from admin panel). 您的客户需要静态CMS页面(从管理面板管理)。

So, Controller, Model and View are not mandatory. 因此,Controller,Model和View不是强制性的。

Create a database table if you don't have pages . 如果没有pages请创建数据库表。

And save page content, page title, meta and other stuff there. 并保存页面内容,页面标题,元和其他东西。

Create a controller (for one time) named page or whatever you choose, 创建一个控制器(一次)命名page或任何你选择的,

Create a function there, and show page from database. 在那里创建一个函数,并从数据库中显示页面。

eg. 例如。 http://yoursite.com/page/show/aboutus http://yoursite.com/page/show/aboutus

Now, it will call show() method from page controller and aboutus is an argument. 现在,它将从page控制器调用show()方法,而aboutus是一个参数。

Fetch data from pages table with aboutus and show it. 从获取的数据pages有表aboutus ,并显示它。

You can rewrite routes with routes.php to make URLs look beautiful. 您可以使用routes.php重写路由,使URL看起来很漂亮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM