在 Yii 中将 wordpress 作为模块或扩展 [英] Have wordpress as a module or extension in Yii

查看:17
本文介绍了在 Yii 中将 wordpress 作为模块或扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向网站添加博客.找不到 Yii 的任何好的博客扩展,所以我决定只使用 Wordpress.(如果有更好的方法请告诉我)

I would like to add a blog to a web site. Couldn't find any good blog extension for Yii, so I decided to just use Wordpress. (Please let me know if there's a better way)

我可以在根文件夹中提取 wordpress 并运行它.

I could just extract wordpress in the root folder and run it.

http://www.example.com/wordpress

然而,Yii 框架在根文件夹中有它的 index.php,所以我必须将 wordpress 设为模块或扩展(我认为),除非我将 Yii 框架放在 root/yiiFolder 中并使用 root/wordpress 分开他们俩.此外,主布局必须与 Yii 默认主布局不同.否则,博客将共享与 Yii 相同的页眉和页脚结构.

However, the Yii framework has its index.php on root folder so I will have to make wordpress either a module or extension (I think) unless I put the Yii framework in a root/yiiFolder and use root/wordpress to separate the two. Also, the main layout will have to be different than the Yii default main layout. Otherwise, the blog will share the same header and footer structure of Yii.

有人能给我一个关于 Yii 框架如何调用 非 yiiframework 站点的例子吗?

Could someone give me an example on how Yii framework call a non-yiiframework site?

推荐答案

如果您遇到以下错误:

include(Translation_Entry.php): 无法打开流:没有那个文件或目录

include(Translation_Entry.php): failed to open stream: No such file or directory

那么你需要禁用自动加载,例如这样:

then you need to disable Autoload, for example like this:

spl_autoload_unregister(array('YiiBase','autoload'));
$wp=dirname(__FILE__).'/../../../../wp-load.php'; 
require_once($wp);
spl_autoload_register(array('YiiBase','autoload'));

这篇关于在 Yii 中将 wordpress 作为模块或扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆