Magento中集成Wordpress最简便的方法

Magento中集成Wordpress最简便的方法
2010-01-22 17:06

上传wordpress安装包到你的magento根根目录,用网址:http://yourdomain/magento/wordpress来 安装,这里的安装路径按你的实际情况来定,如果你的magento直接安装在网站根目录,那么就用http://yourdomain /wordpress来安装,注意安装的时候你可以装在magento的数据库中,最好把你的wordpress的表加个前缀防止和magento的表有 冲突,当然你也可以把wordpress安装在独立的数据库。

安装好后接下来我们就要想办法把wordpress的文章调用到magento页面中,最简便的办法就是把wordpress的RSS输出的内容输入到magento z中。

新建一个文件,放在magento的template的模块中,例如我们新建app/design/frontend/default/default/template/callouts/magento_blog.phtml文件,然后加入代码:

<?php $channel = new Zend_Feed_Rss('http://yourdomin/blog/?feed=rss2'); ?>
<div>
<div>
<h2><?php echo $this->__('Latest Articles form the Blog') ?></h2>
</div>
<div>
<ol id="graybox-latest-news">
<?php foreach ($channel as $item): ?>
<li><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></li>
<?php endforeach; ?>
</ol>
</div>
</div>

现在我们就要在magento布局中调用这个magento_blog.phtml文件,

1.如果想在产品页右栏调用:

打开catalog.xml文件 找到<catalog_product_view>,然后在<refrence name="right"></refrence>中加入代码,

<block type="core/template"  template="callouts/magento_blog.phtml"/>

2.在CMS页面中调用:

{{block type="core/template"  template="callouts/magento_blog.phtml"/}}

接下来讲介绍另外一种集成wordpress的方法(待续)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值