繁体   English   中英

如何在安装Joomla时显示自定义错误! 1.6 - 1.7组件?

[英]How to show custom error while installing a Joomla! 1.6 - 1.7 component?

我正在为Joomla编写安装脚本! 1.7组件。 如何修改脚本的install()部分,以便在出现故障时,我可以向用户显示格式错误的HTML错误?

目前,我只从install()例程返回false ,这会产生一个神秘的错误消息:

组件安装:自定义安装例程失败

joomla/installer/adapters/component.php的component.php文件具有以下代码,这使我怀疑我无法更改abort()消息。

if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'install')) 
{
     if ($this->parent->manifestClass->install($this) === false) {
          // Install failed, rollback changes
          $this->parent->abort(JText::_('JLIB_INSTALLER_ABORT_COMP_INSTALL_CUSTOM_INSTALL_FAILURE'));
          return false;
     }
  }

在返回错误之前,我可以引发错误,该错误在黄色框中很好地显示。

JError::raiseNotice(1, "Error Message <html code>");
return false;

在返回错误之前,我可以引发错误,该错误在黄色框中很好地显示。

JError::raiseNotice(1, "Error Message <html code>");
return false;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM