Blog

magento新闻插件

magento新闻插件 magento新闻功能是很多网站都要添加的,这使浏览者可以更快地了解你这个站的有什么活动,有什么优惠和将要举行的活动等等信息.从而达到吸引客户的目的.网络上有很多magento新闻插件的版本,也有不同的安装方法.这里说两种: 1. 先下载news插件 KEY:Magento Connect: magento-community/MWD_News_and_Testimonials_with_Images_Extension.在后面CMS/pages 建立一个关于新闻的pages,填好相关的信息.在Content下加入{{block type="profile/profile" template="profile/news.phtml"}}(这个是connect插件后文件的位置)然后保存.再在前台相关的地方加一个链接,链到对就的URL就可以了. 2. 先下载news插件 KEY:Magento Connect:magento-community/news 现在在前台显示内容时,点击边栏的标题时是以层的型势弹出来,而需求是想点击标题以网页的型势展现内容,所以这就需要修改news.xml文件及对应的插件控制器了,下面把方法说一下,希望对遇到这类问题的朋友有所帮助: 在后台下 载MAGENTO新闻插件后,插件文件夹被下载到app/code/local/下,首先我们到app/design/frontend /default/default/layout/下找到news.xml文件,在DEFAULT下面加入以下代码(假设Index控制器中的方法名为 content): <news_index_content> <reference name = “content”> <block type = “news/news”  name = “news_content” template=”news/content.phtml” /> </reference > </news_index_content> 然后在IndexController中增加contentAction()方法,这段代码的目的是显示模版,代码如下: public function contentAction(){ $this->loadLayout(); $this->renderLayout(); //**echo  $this -> getLayout()-> createBlock( ‘news/block’ )->setBlockId( ‘block_id’ )-> toHtml(); /*$collection = Mage::getModel(’news/news’)->getCollection(); $collection->getNews(); foreach ($collection as $item) { if($item->getnews_id()==$newsIds){ $Title = $item->gettitle(); $Content = $item->getcontent(); $Date = $item->getdate(); } }*/ //echo $Content; //include(’content.phtml’); } 找到News.php文件,在下面加入方法: public function getPPP() { $collection = Mage::getModel(’news/news’)->getCollection(); $newsIds = $this->getRequest()->getParam(’id’); $newsObj = Mage::getModel(’news/news’); $room = $newsObj->load($newsIds); return $room; } 下面在news.phtml同目录下创建content.pthml文件: getPPP()->getTitle();
echo ‘ ’; echo $this->getPPP()->getdate(); echo ‘ ’; echo $this->getPPP()->getContent(); ?> 这样magento的新闻插件模版就整合成功了.

Words translated by CCJK

146,096,379

Request a call or contact us

  •  

    Call ccjk.support for professional assistance

  •  

    Click Here to leave us a message and be as detailed as possible.

We are Certified

Our Client Satisfaction

rating for previous quarte

4.00
  •  
    Inquiry Form

    Please take few minutes to fill
    inquiry form and get Free Quote

  •  
    Request a Call

    Click to receive Free Call, Our
    Representative will contact you

  •  
    Leave a Message

    Please leave us a message and
    be as detailed as possible

Over 95% of our clients recommend our language services to others


Copyright © CCJK Technologies Co., Ltd. 2000-2017. All rights reserved.
TOP