I have created a custom module one part is working fine that is adminform now i have create a grid to show all the data saved in database. But all i get is blank page.
Here is my grid.php file:
<?php
class OptFirst_ReviewMyCompany_Block_Adminhtml_Review_Grid extends
Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('reviewGrid');
$this->setDefaultSort('id_optfirst_reviewmycompany');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel('optfirst_reviewmycompany/review')->getCollection();
//print_r($collection);
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('id', array(
'header' => Mage::helper('optFirst_reviewMyCompany')->__('Facebook'),
'align' => 'right',
'width' => '10px',
'index' => 'id',
));
$this->addColumn('name', array(
'header' => Mage::helper('optFirst_reviewMyCompany')->__('Google'),
'align' => 'left',
'index' => 'name',
'width' => '50px',
));
$this->addColumn('content', array(
'header' => Mage::helper('optFirst_reviewMyCompany')->__('Twitter'),
'width' => '150px',
'index' => 'content',
));
return parent::_prepareColumns();
}
}
And here is my controller:
<?php
class OptFirst_ReviewMyCompany_Adminhtml_ReviewController extends Mage_Adminhtml_Controller_action
{
public functio indexAction() {
$this->loadLayout();
$this->renderLayout();
}
public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('optfirst_reviewmycompany/adminhtml_review_grid')->toHtml()
);
}
}
And here is my confix.xml
<?xml version="1.0"?>
<config>
<modules>
<OptFirst_ReviewMyCompany>
<version>1.0.0</version>
</OptFirst_ReviewMyCompany>
</modules>
<global>
<blocks>
<optfirst_reviewmycompany>
<class>OptFirst_ReviewMyCompany_Block</class>
</optfirst_reviewmycompany>
</blocks>
<helpers>
<optfirst_reviewmycompany>
<class>OptFirst_ReviewMyCompany_Helper</class>
</optfirst_reviewmycompany>
</helpers>
<models>
<optfirst_reviewmycompany>
<class>OptFirst_ReviewMyCompany_Model</class>
<resourceModel>optfirst_reviewmycompany_resource</resourceModel>
</optfirst_reviewmycompany>
<optfirst_reviewmycompany_resource>
<class>OptFirst_ReviewMyCompany_Model_Resource</class>
<entities>
<review>
<table>optfirst_reviewmycompany</table>
</review>
</entities>
</optfirst_reviewmycompany_resource>
</models>
<resource>
<optfirst_reviewmycompany_setup>
<setup>
<module>OptFirst_ReviewMyCompany</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</optfirst_reviewmycompany_setup>
<optfirst_reviewmycompany_write>
<connection>
<use>core_write</use>
</connection>
</optfirst_reviewmycompany_write>
<optfirst_reviewmycompany_read>
<connection>
<use>core_read</use>
</connection>
</optfirst_reviewmycompany_read>
</resource>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<optfirst_reviewmycompany after="Mage_Adminhtml">OptFirst_ReviewMyCompany_Adminhtml</optfirst_reviewmycompany>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<optfirst_reviewmycompany>
<file>optfirst_reviewmycompany.xml</file>
</optfirst_reviewmycompany>
</updates>
<updates>
<review>
<file>review.xml</file>
</review>
</updates>
</layout>
<translate>
<modules>
<optfirst_reviewmycompany>
<files>
<default>OptFirst_ReviewMyCompany.csv</default>
</files>
</optfirst_reviewmycompany>
</modules>
</translate>
</adminhtml>
<default>
<optfirst_reviewmycompany>
<general>
<default_sort_by><![CDATA[position]]></default_sort_by>
</general>
</optfirst_reviewmycompany>
</default>
My Helper Class in OptFirst/ReviewMyCompany/Helper/Data.php
<?php
class OptFirst_ReviewMyCompany_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Can you please check what is wrong and why its not showing the grid container?