博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Create a sample admin module for form processing
阅读量:6848 次
发布时间:2019-06-26

本文共 3680 字,大约阅读时间需要 12 分钟。

  hot3.png

Module declaration

Filename: app/etc/modules/Mage_Sintax.xml

true
local

Module configuration file

Filename: app/code/local/Mage/Sintax/etc/config.xml

0.1.0
Mage_Sintax_Model
sintax_mysql4
Mage_Sintax_Model_Mysql4
Mage_Sintax_Block
Mage_Sintax_Helper
admin
Mage_Sintax
sintax
Mage_Sintax.csv
My Form
sintax/adminhtml_myform
My Form
sintax.xml

Controller

Filename: app/code/local/Mage/Sintax/controllers/Adminhtml/MyformController.php

loadLayout()->renderLayout(); } public function postAction() { $post = $this->getRequest()->getPost(); try { if (empty($post)) { Mage::throwException($this->__('Invalid form data.')); } /* here's your form processing */ $message = $this->__('Your form has been submitted successfully.'); Mage::getSingleton('adminhtml/session')->addSuccess($message); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } $this->_redirect('*/*'); }}

Form block

Filename: app/code/local/Mage/Sintax/Block/Myform.php

// this step is optional

Layout updates for your form

Filename: app/design/adminhtml/default/default/layout/sintax.xml

Form template

Filename: app/design/adminhtml/default/default/template/sintax/myform.phtml

__('My form title')?>

__('This fieldset name')?>

__('Field label')?> *

Translations

Filename: app/locale/en_US/Mage_Sintax.csv

// this step is optional

Helper

Filename: app/code/local/Mage/Sintax/Helper/Data.php

转载于:https://my.oschina.net/stream/blog/103058

你可能感兴趣的文章