· 6 years ago · Aug 16, 2019, 11:18 AM
1<?xml version="1.0"?>
2<config>
3 <modules>
4 <Svi_Form>
5 <active>true</active>
6 <codePool>local</codePool>
7 </Svi_Form>
8 </modules>
9</config>
10
11<?php
12Class Svi_Form_IndexController extends Mage_Core_Controller_Front_Action{
13 public function indexAction(){
14 $layout =$this->loadLayout();
15 $this->renderLayout();
16 }
17
18 public function postAction(){
19 $post = $this->getRequest()->getPost();
20 print_r($post);exit;
21 }
22
23}
24?>
25
26<?xml version="1.0"?>
27<config>
28 <modules>
29 <Svi_Form>
30 <version>0.1.0</version>
31 </Svi_Form>
32 </modules>
33
34 <frontend>
35 <routers>
36 <form>
37 <use>standard</use>
38 <args>
39 <module>Svi_Form</module>
40 <frontName>form</frontName>
41 </args>
42 </form>
43 </routers>
44 <layout>
45 <updates>
46 <form>
47 <file>form.xml</file>
48 </form>
49 </updates>
50 </layout>
51 </frontend>
52 <global>
53 <models>
54 <form>
55 <class>Svi_Form_Model</class>
56 <resourceModel>form_mysql4</resourceModel>
57 </form>
58 <form_mysql4>
59 <class>Svi_Form_Model_Mysql4</class>
60 <entities>
61 <form>
62 <table>svi_form</table>
63 </form>
64 </entities>
65 </form_mysql4>
66 </models>
67 <resources>
68 <form_setup>
69 <setup>
70 <module>Svi_Form</module>
71 </setup>
72 <connection>
73 <use>core_setup</use>
74 </connection>
75 </form_setup>
76 <form_write>
77 <connection>
78 <use>core_write</use>
79 </connection>
80 </form_write>
81 <form_read>
82 <connection>
83 <use>core_read</use>
84 </connection>
85 </form_read>
86 </resources>
87 <blocks>
88 <form>
89 <class>Svi_Form_Block</class>
90 </form>
91 </blocks>
92 <helpers>
93 <form>
94 <class>Svi_Form_Helper</class>
95 </form>
96 </helpers>
97 </global>
98</config>
99
100<?php
101class Svi_Form_Block_Form extends Mage_Core_Block_Template
102{
103
104}
105
106<?php
107class Svi_Form_Helper_Data extends Mage_Core_Helper_Abstract
108{
109
110}
111
112<?php
113class Svi_Form_Model_Form extends Mage_Core_Model_Abstract
114{
115 public function _construct()
116 {
117 parent::_construct();
118 $this->_init('form/form');
119 }
120}
121
122<?php
123class Svi_Form_Model_Mysql4_Form extends Mage_Core_Model_Mysql4_Abstract
124{
125 public function _construct()
126 {
127 $this->_init('form/form', 'prical_id');
128 }
129}
130
131<?php
132class Svi_Form_Model_Mysql4_Form_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
133{
134 public function _construct()
135 {
136 //parent::__construct();
137 $this->_init('form/form');
138 }
139}
140
141<?php
142$installer = $this;
143
144$installer->startSetup();
145
146$installer->run("
147
148-- DROP TABLE IF EXISTS {$this->getTable('svi_form')};
149CREATE TABLE {$this->getTable('svi_form')} (
150 `prical_id` int(11) unsigned NOT NULL auto_increment,
151 `title` varchar(255) NOT NULL default '',
152 `content` text NOT NULL default '',
153 `status` smallint(6) NOT NULL default '0',
154 `created_time` datetime NULL,
155 `update_time` datetime NULL,
156 PRIMARY KEY (`prical_id`)
157) ENGINE=InnoDB DEFAULT CHARSET=utf8;
158
159 ");
160
161$installer->endSetup();