php - Custom Module Page Not Rendering Template - Magento -


i'm developing custom module new form (nothing fancy). i've created custom template , i'm trying render through controller (i've tried xml didn't work) using:

$this->loadlayout(); $this->getlayout()->getblock('blockname'); $this->renderlayout(); 

but when go page site's header , footer etc. not content.

here files:

indexcontroller.php

<?php         class class_module_indexcontroller extends mage_core_controller_front_action {         public function predispatch() {             parent::predispatch();             $this->getlayout()->getupdate()->addhandle('module_default');         }         public function indexaction() {             $this->loadlayout();             $this->getlayout()->getblock('blockname');             $this->renderlayout();         }         public function postaction() {             $_post = $this->getrequest()->getpost();             // form fields             $_name        = $_post['name'];             $_to          = $_post['email'];             $_phonemodel  = $_post['phone_model'];             $_phonenumber = $_post['phone_number'];             $_issue       = $_post['issue'];             // email set             $_subject = 'a subject';             $_message = 'hey, ' . $_name . 'said there phone (' . $_phonemodel . ') has following issue:';             $_message .= $_issue;             $_message .= 'their number ' . $_phonenumber;             // magento mail set             $_mail = mage::getmodel('core/email');             $_mail->settoname($_name);             $_mail->settoemail($_to);             $_mail->setbody($_message);             $_mail->setsubject($_subject);             // send mail             try {                 $_mail->send();                 mage::getsingleton('customer/session')->addsuccess('email sent successfully!');                 $this->_redirect('');             } catch (exception $e) {                 mage::getsingleton('core/session')->adderror('unable send message. please try again later.');                 $this->_redirect('');             }         }     } 

my config.xml file:

<?xml version="1.0" encoding="utf-8" ?> <config>     <modules>         <class_module>             <version>0.1.0</version>         </class_module>     </modules>     <frontend>         <routers>             <module>                 <use>standard</use>                 <args>                     <module>class_module</module>                     <frontname>module</frontname>                 </args>             </module>         </routers>     </frontend>     <!-- attempt xml -->     <global>         <page>             <layouts>                 <module module="page" translate="label">                     <label>label</label>                     <template>contacts/template.phtml</template>                     <layout_handle>block_form_default</layout_handle>                 </module>             </layouts>         </page>     </global> </config> 

and template.phtml file:

<div id="messages_product_view">     <?= $this->getmessagesblock()->getgroupedhtml() ?> </div> <div class="page-title">     <h1>title</h1> </div> <form id="formid" method="post" action="<?= $this->getformaction() ?>">     <div class="fieldset">         <ul class="fields">             <li class="field">                 <label for="name" class="required">name</label>                 <div class="input-box">                     <input type="name" name="name" placeholder="john/jane doe" />                 </div>             </li>             <li class="field">                 <label for="email" class="required">email address</label>                 <div class="input-box">                     <input type="email" name="email" placeholder="example@example.co.uk" />                 </div>             </li>             <li class="field">                 <label for="phone_model" class="required">phone model</label>                 <div class="input-box">                     <input type="name" name="phone_model" placeholder="htc desire 310" />                 </div>             </li>             <li class="field">                 <label for="phone_number" class="required">phone number</label>                 <div class="input-box">                     <input type="number" name="phone_number" placeholder="0123456789" />                 </div>             </li>             <li class="field">                 <label for="issue" class="required">issue</label>                 <textarea name="issue"></textarea>             </li>         </ul>     </div>     <div class="buttons-set">         <input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />         <button type="submit" title="submit" class="button">             <span>                 <span>submit</span>             </span>         </button>     </div> </form>  <script>     //<![cdata         var form = new varienform('formid', true);     //]]> </script> 

i've been scratchin' head hours. appreciated.

thanks

weird way of defining layout (in config.xml). i've never seen :d maybe try define layout in standard way separate xml file, here http://www.webspeaks.in/2010/07/create-your-first-magento-module.html have tutorial. since 5 years make modules , work :)


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -