Magento - 尝试创建新的Adminhtml页面时出现错误404
我正在使用Magento 1.9.0.1,并且我创建了一个新的扩展程序,在该扩展程序中我在管理面板中添加了一个新标签查看图片。Magento - 尝试创建新的Adminhtml页面时出现错误404
以下是我在我的文件。
在:/app/code/community/VivasIndustries/SmsNotification/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<VivasIndustries_SmsNotification>
<version>0.1.0</version>
</VivasIndustries_SmsNotification>
</modules>
<global>
<models>
<smsnotification>
<class>VivasIndustries_SmsNotification_Model</class>
</smsnotification>
</models>
<events>
<sales_order_save_after>
<observers>
<vivasindustries_smsnotification>
<class>smsnotification/observer</class>
<method>orderSaved</method>
</vivasindustries_smsnotification>
</observers>
</sales_order_save_after>
</events>
<helpers>
<smsnotification>
<class>VivasIndustries_SmsNotification_Helper</class>
</smsnotification>
<adminhtml>
<rewrite>
<data>VivasIndustries_SmsNotification_Helper_Adminhtml_Data</data>
</rewrite>
</adminhtml>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<VivasIndustries_SmsNotification before="Mage_Adminhtml">VivasIndustries_SmsNotification_Adminhtml</VivasIndustries_SmsNotification>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
这里是我在:/应用程序/代码/社区/ VivasIndustries/SMS通知的/ etc/adminhtml.xml:
<?xml version="1.0"?>
<config>
<menu>
<vivassms translate="title" module="smsnotification">
<title>SMS Center</title>
<sort_order>110</sort_order>
<children>
<sendsms translate="title" module="smsnotification">
<title>Send SMS</title>
<action>adminhtml/magesms_sendsms</action>
<sort_order>1</sort_order>
</sendsms>
<settings>
<title>Settings</title>
<action>adminhtml/system_config/edit/section/vivas/</action>
<sort_order>10</sort_order>
</settings>
<about translate="title" module="smsnotification">
<title>About</title>
<action>adminhtml/smsnotification_about</action>
<sort_order>11</sort_order>
</about>
</children>
</vivassms>
</menu>
<acl>
<resources>
<admin>
<children>
<vivassms>
<title>SMS</title>
<children>
<sendsms translate="title" module="smsnotification">
<title>Send SMS</title>
</sendsms>
<settings>
<title>Settings</title>
<children>
<smsprofile translate="title" module="smsnotification">
<title>Edit user account</title>
</smsprofile>
</children>
</settings>
<about translate="title" module="smsnotification">
<title>About</title>
</about>
</children>
</vivassms>
<system>
<children>
<config>
<children>
<vivassms translate="title" module="smsnotification">
<title>Vivas SMS</title>
</vivassms>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
这里是我有:/app/code/community/VivasIndustries/SmsNotification/controllers/Adminhtml/SmsNotification/AboutController.php:
<?php
class VivasIndustries_SmsNotification_Adminhtml_AboutController extends Mage_Adminhtml_Controller_Action
{
public function preDispatch()
{
return Mage_Adminhtml_Controller_Action::preDispatch();
}
public function indexAction()
{
$this->_initAction();
$i8ee45e0018a32fb1a855b82624506e35789cc4d2 = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'my_block_name_here', array('template' => 'vivasindustries/smsnotification/about.phtml'));
$this->getLayout()->getBlock('content')->append($i8ee45e0018a32fb1a855b82624506e35789cc4d2); $this->renderLayout();
}
protected function _initAction()
{
parent::_initAction();
$this->_setActiveMenu('smsnotification/about') ->_title(Mage::helper('smsnotification')->__('About'));
return $this;
}
}
这里是我有:/app/design/adminhtml/default/default/template/vivasindustries/smsnotification/about.phtml:
<?php
/**
* Mage SMS - SMS notification & SMS marketing
*
* NOTICE OF LICENSE
*
* This source file is subject to the BSD 3-Clause License
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/BSD-3-Clause
*
* @category Vivas
* @package Vivas_smsnotification
* @copyright Copyright (c) 2012-2014 Vivas s.r.o. (http://www.mage-sms.com)
* @license http://opensource.org/licenses/BSD-3-Clause
*/
?>
<h2>
<?php
echo Mage::helper('smsnotification')->__('About'); ?></h2>
<b><?php echo Mage::helper('smsnotification')->__('Mage SMS module 2013-%s, version ', date('Y')).Mage::getConfig()->getModuleConfig('VivasIndustries_SmsNotification')->version; ?></b><br />
<?php echo Mage::helper('smsnotification')->__('Copyright © Vivas s.r.o., All rights reserved'); ?><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Supported Magento versions:'); ?></b><?php echo Mage::getConfig()->getNode('default/config/supported')->versions; ?><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Developer:'); ?></b><br /><?php echo Mage::helper('smsnotification')->__('Vivas s.r.o.'); ?><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Address:'); ?></b><br /><?php echo Mage::helper('smsnotification')->__('B. Nemcove 767/13'); ?><br /><?php echo Mage::helper('smsnotification')->__('78701 Sumperk'); ?><br />
<?php echo Mage::helper('smsnotification')->__('Czech Republic'); ?><br /><?php echo Mage::helper('smsnotification')->__('VAT: CZ29444268'); ?><br /><br /><b><?php echo Mage::helper('smsnotification')->__('Office Telephone:'); ?></b><br />
<?php echo Mage::helper('smsnotification')->__('+420 581 110 998'); ?><br /><br /><b><?php echo Mage::helper('smsnotification')->__('E-mail:'); ?></b><br />
<a href="mailto:<?php echo Mage::helper('smsnotification')->__('[email protected]'); ?>"><?php echo Mage::helper('smsnotification')->__('[email protected]'); ?></a><br />
<a href="mailto:<?php echo Mage::helper('smsnotification')->__('[email protected]'); ?>"><?php echo Mage::helper('smsnotification')->__('[email protected]'); ?></a><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Web:'); ?></b><br />
<a href="http://<?php echo Mage::helper('smsnotification')->__('www.mage-sms.com'); ?>"><?php echo Mage::helper('smsnotification')->__('www.mage-sms.com'); ?></a><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Facebook:'); ?></b><br /><iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fmagentosms&width&layout=button_count&action=like&show_faces=false&share=true&height=21&appId=242281502635180" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe><br /><br />
<b><?php echo Mage::helper('smsnotification')->__('Manual:'); ?></b><br /><a href="http://<?php echo Mage::helper('smsnotification')->__('www.mage-sms.com/manual.html'); ?>"><?php echo Mage::helper('smsnotification')->__('www.mage-sms.com/manual.html'); ?></a><br /><br />
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'smsnotification/Vivas-logo.gif'; ?>" alt="Vivas" />
当我尝试打开About
页我得到错误404 。 你能帮我解决这个错误,并告诉我为什么我有这个问题吗?
编辑: 图像错误的:提前
谢谢!
它应该在你的XML文件中。因为您可以在错误页面的底部看到它正在寻找不同的地址(../Smsnotification/ ..,但是您的控制器位于:../SmsNotification/ ..)。应该在这个部分:
<about translate="title" module="smsnotification">
<title>About</title>
<action>adminhtml/smsnotification_about</action>
<sort_order>11</sort_order>
</about>
尝试使用smsNotification并查看它是否有效。
我做了你所说的并且有我得到的错误报告:http://pastebin.com/GYFeGTrt – 2015-02-07 11:45:39
所以现在你的控制器被Magento发现,但是它里面的类没有找到。尝试将您的控制器类名更改为: 'class VivasIndustries_SmsNotification_Adminhtml_SmsNotification_AboutController' – Hatef 2015-02-07 12:43:27
Magento有许多不同的404页面 - 知道哪一个可以帮助人们帮助你:http://alanstorm.com/magentos_many_404_pages另外,给我的Better404模块(免费)一个尝试 - 它会让Magento的MVC-404页面在追踪问题时更有用http://alanstorm.com/magento-404-debug – 2015-02-06 20:17:00
感谢您的回答!我更新了我的问题,并在安装插件时添加了404错误的图片!你可以请教我,问题在哪里?提前致谢! – 2015-02-06 20:26:05