new page in backend in magento
hi i have download the module creator from http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table. i have added this in my website. and i开发者_开发问答ts working fine but the problem is that i want to make a tempale page for this . i dont want to use grid in this. how can i do this. although i have added template page in xml page. and i have created the the template page.but there is blank page showing. how can i resove this issue.
Two steps to do what you want to do :
(please watch out lower and uppercase)
1- Update the adminhtml Block class
- Open app/local/[YourNamespace]/[YourModule]/Block/Adminhtml/[YourModule]/Grid.php
In the class declaration change :
class [YourNamespace]_[YourModule]_Block_Adminhtml_[YourModule]_Grid extends Mage_Adminhtml_Block_Widget_Grid
to
class [YourNamespace]_[YourModule]_Block_Adminhtml_[YourModule]_Grid extends Mage_Adminhtml_Block_Widget_Form_Container
then clear all the content (methods) of the file and replace it with :
public function __construct() {
parent::__construct();$this->setTemplate('[yourmodule]/[some-template-filename].phtml');
$this->setId('[some_id]');
}
2- Create your template file
Create app/design/adminthml/default/default/template/[youmodule]/[some-template-filename].phtml You will find ideas and inspiration by digging into other Magento modules but here is some starting point :
<div class="content-header">
<table cellspacing="0" class="grid-header">
<tr>
<td><h3><?php echo $this->__('A nice title'); ?></h3></td>
<td class="a-right">
<button onclick="history.go(-1)" class="scalable back" type="button"><span><?php echo $this->__('Cancel'); ?></span></button>
<button onclick="editForm.submit()" class="scalable save" type="button"><span><?php echo $this->__('Save'); ?></span></button>
</td>
</tr>
</table>
</div>
<div class="entry-edit">
<form id="edit_form" name="edit_form" method="post" action="YOUR JOB TO CALL THE RIGHT CONTROLLER">
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Another nice title')?></h4>
<fieldset id="my-fieldset">
<table cellspacing="0" class="form-list">
<tr>
<td class="label"><?php echo $this->__('A nice TD title'); ?> <span class="required">*</span></td>
<td class="label required-entry">
CONTENT FOR YOUR TD
</td>
</tr>
</table>
</fieldset>
</form>
</div>
<script type="text/javascript">
var editForm = new varienForm('edit_form');
</script>
All the above should guide you to want to want to achieve but as long as you won't be using the item edit usually provided by clicking on some line of the "regular" grid generated by Module Creator, a full bench of the code, files and folders created by Module Creator is now obsolete.
My best bet would be to make your own module from scratch :)
精彩评论