On a button click, when my controller redirects to a new form, i want my custom phtml file to be called from the block.
But neither my Block or my phtml does seem to be called.
I guess I have missed some link somewhere
I have done as below:
config.xml
<config>
<modules>
<Vendor_Recipe>
<version>1.0.0</version>
</Vendor_Recipe>
</modules>
<global>
<blocks>
<vendor_recipe>
<class>Vendor_Recipe_Block</class>
</vendor_recipe>
</blocks>
<models>
<vendor_recipe>
<class>Vendor_Recipe_Model</class>
<resourceModel>vendor_recipe_resource</resourceModel>
</vendor_recipe>
</models>
</global>
<frontend>
<routers>
<vendor_recipe>
<use>standard</use>
<args>
<module>Vendor_Recipe</module>
<frontName>vendor_recipe</frontName>
</args>
</vendor_recipe>
</routers>
<layout>
<updates>
<vendor_recipe>
<file>vendor_recipe.xml</file>
</vendor_recipe>
</updates>
</layout>
</frontend>
I have a button here:
\app\design\frontend\base\default\template\vendor_recipe\recipe\customer\comment\list.phtml
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title">
<form action="<?php echo $this->getUrl('vendor_recipe/manageRecipe/addRecipe') ?>" method="post" id="form-validate" autocomplete="off">
<button type="submit" class="button" title="<?php echo $this->__('Add New Recipe') ?>">
<span><span><?php echo $this->__('Add New Recipe') ?></span></span>
</button>
</form>
Where in :
\app\code\local\Vendor\Recipe\controllers\ManageRecipeController.php
<?php
class Vendor_Recipe_ManageRecipeController extends Mage_Core_Controller_Front_Action
{
public function addRecipeAction()
{
//echo 'Add recipe';
$this->loadLayout();
$this->renderLayout();
}
}
Calling addrecipe.phtml from layout as:
\app\design\frontend\base\default\layout\vendor_recipe.xml
<vendor_recipe_recipe_customer_manage translate="label" module="vendor_recipe">
<label>My Recipes </label>
<update handle="customer_account"/>
<reference name="my.account.wrapper">
<block type="vendor_recipe/recipe_customer_managerecipe" name="customer_recipe_add" template="vendor_recipe/recipe/customer/managerecipe/addrecipe.phtml"/>
</reference>
</vendor_recipe_recipe_customer_manage>
\app\code\local\Vendor\Recipe\Block\Recipe\Customer\ManageRecipe.php
class Vendor_Recipe_Block_Recipe_Customer_ManageRecipe extends Mage_Customer_Block_Account_Dashboard
{
protected function _construct(){
echo 'Block ';
}
}
\app\design\frontend\base\default\template\vendor_recipe\recipe\customer\managerecipe\addrecipe.phtml
<?php
echo 'ADD';die;
?>