我在Magento社区论坛上创建了一个帖子,但似乎没有人可以回答它,所以我在这里发帖。
我可以在我的帐户左侧菜单上添加一个链接,但是当我点击它时,它会给我一个404错误。 我的文件有什么问题吗?地点?或者这是我的代码的问题? 我的控制器:
class Mage_Customer_TrainingController extends Mage_Core_Controller_Front_Action
{
protected function _getSession()
{
return Mage::getSingleton('customer/session');
}
public function preDispatch()
{
parent::preDispatch();
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
}
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
控制器位置:
customer.xml for layout
<reference name="left_first">
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
<action method="addLink" translate="label" module="customer"><name>training</name><path>customer/training/</path><label>Training Material</label></action>
</block>
</reference>
<customer_training_index translate="label">
<label>Customer Training</label>
<!-- Mage_Customer -->
<update handle="customer_account"/>
<reference name="my.account.wrapper">
<block type="customer/training" name="customer_training" template="customer/training/training.phtml"/>
</reference>
</customer_training>
<div class="dashboard">
<div class="page-title">
<h1><?php echo $this->__('Healthy Living & Knowledge of Chinese Medicine') ?></h1>
</div>
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('training_material')->toHtml();
?>
</div>
<?php
class Mage_Customer_Block_Training extends Mage_Customer_Block_Account_Dashboard // Mage_Core_Block_Template
{
// public function __construct()
// {
// parent::__construct();
// $this->setTemplate('customer/form/training.phtml');
// }
// public function getIsSubscribed()
// {
// return $this->getSubscriptionObject()->isSubscribed();
// }
public function getTrainingUrl()
{
return $this->getUrl('customer/training/');
}
}