[英]How would I recreate the list of pages grid that's seen in CMS->Pages in my own module in Magento
I have created a Magento admin module with it's own menu and page in the back-end, and am trying to recreate how CMS->Pages
lists every page in it's grid on my own page, then add my own column. 我已经创建了一个Magento管理模块,并在后端使用了自己的菜单和页面,并尝试重新创建
CMS->Pages
如何在自己的页面上列出其网格中的每个页面,然后添加自己的列。
So far, after switching on template hints for the admin section, I have seen that the original Magento CMS section template is loaded from adminhtml\\default\\default\\template\\widget/grid.phtml
. 到目前为止,打开admin部分的模板提示后,我已经看到原始的Magento CMS部分模板是从
adminhtml\\default\\default\\template\\widget/grid.phtml
。
I have copied the contents of this file to my page, but of course, the $this
reference that the original uses doesn't have the same loaded classes/data asociated with it on my own module page. 我已将此文件的内容复制到我的页面,但是,当然,原始使用的
$this
引用在我自己的模块页面上没有与之关联的相同加载类/数据。
Can anyone tell me if I'm along the right lines with this, or how I might achieve the same effect as CMS->Pages
, but on my own page and adding my own column? 谁能告诉我我是否正确,或者如何实现与
CMS->Pages
相同的效果,但是在我自己的页面上并添加自己的列?
To accomplish this you can create a custom module that extend /app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php 为此,您可以创建一个扩展/app/code/core/Mage/Adminhtml/Block/Cms/Block/Grid.php的自定义模块
Assuming that you're adding a database field to cms table 假设您要向cms表添加数据库字段
Create /app/code/local/RWS/CmsGrid/etc/config.xml 创建/app/code/local/RWS/CmsGrid/etc/config.xml
<global>
<blocks>
<adminhtml>
<rewrite>
<cms_block_grid>RWS_CmsGrid_Block_Cms_Block_Grid</cms_block_grid>
</rewrite>
</adminhtml>
</blocks>
</global>
Create /app/code/local/RWS/CmsGrid/Block/Cms/Block/Grid.php 创建/app/code/local/RWS/CmsGrid/Block/Cms/Block/Grid.php
class RWS_CmsGrid_Block_Cms_Block_Grid extends Mage_Adminhtml_Block_Cms_Block_Grid
{
protected function _prepareColumns()
{
$this->addColumn('xxxxxx', array(
'header' => Mage::helper('cms')->__('Xxxxx'),
'align' => 'left',
'index' => 'title',
));
..........
See more info 查看更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.