CodeIgniter + Wordpress集成 [英] CodeIgniter + Wordpress integration
问题描述
我的网站是用Wordpress设计的。一些主题页面有一个定制的PHP脚本用于预订的东西,我想在CodeIgniter重构,以获得更多的灵活性。问题:
1)如何在CI中使用CI的路由系统的CI功能?
我必须创建一个CI页面index.php / controller / page1 /然后在Wordpress中调用它吗?
2)我必须使用CodeIgniter
我使用了以下内容。
我的目标是对一些页面使用CodeIgniter,并保持Wordpress中的其他页面不变。我只需要执行几个步骤:
在Wordpress根目录复制CI文件夹
修改« index.php»添加一个include,这将添加WP函数到CodeIgniter:
@require'../wp- load.php';
require_once BASEPATH.'core / CodeIgniter.php';
一旦这一行被添加,Wordpress功能将可用于CodeIgniter;它们将主要用于视图。
修改WP的.htaccess以不重写CI的URL:
此行之后:
RewriteRule ^ index\.php $ - [L]
添加此行:
RewriteCond%{REQUEST_URI}!^ /(codeigniter_folder | codeigniter_folder /。 *)$
然后CI视图可以使用WP函数。
My website is designed with Wordpress. Some theme pages have a custom made PHP script for booking things, which I want to refactor in CodeIgniter, to get more flexibility. Questions :
1) how to use CI functions in WP with CI's routing system ? Do I have to make a CI page index.php/controller/page1/ and then call it in Wordpress ?
2) Do I have to use CodeIgniter "views" system or Wordpress "theme pages" to get my result ?
Thanks
I used the following.
My goal is to use CodeIgniter for some pages, and leave the other pages in Wordpress untouched. I only have a few steps to do it :
Copy CI folder at the Wordpress root
Modify the « index.php » of CI to add an include which will add WP functions to CodeIgniter :
@require '../wp-load.php';
require_once BASEPATH.'core/CodeIgniter.php';
Once this line added, Wordpress functions will be usable in CodeIgniter ; they will be used mainly for views.
Modify the .htaccess of WP to not rewrite CI's URLs : After this line :
RewriteRule ^index\.php$ - [L]
Add this line :
RewriteCond %{REQUEST_URI} !^/(codeigniter_folder|codeigniter_folder/.*)$
Then CI views can use WP functions.
这篇关于CodeIgniter + Wordpress集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!