【问题标题】:Joomla Error Message File DirectoryJoomla 错误信息文件目录
【发布时间】:2017-09-16 13:46:55
【问题描述】:

我正在尝试学习如何创建 joomla 模板。我成功覆盖了模板上的一些模块和组件,但是我无法覆盖错误消息,尤其是在表单验证时。

我想知道文件的位置,是否可以覆盖?我的目的是添加一些引导类并在其上添加更多标签。

【问题讨论】:

  • 什么错误信息和经过什么处理?您可以在 /templates/(name_of_template) 中搜索模板
  • 我只是想替换错误信息的css类问题是我不知道去哪里找php文件

标签: php html css twitter-bootstrap joomla


【解决方案1】:

实际生成的系统消息在/layouts/joomla/system/message.php

<div id="system-message-container">
  <?php if (is_array($msgList) && !empty($msgList)) : ?>
  <div id="system-message">
    <?php foreach ($msgList as $type => $msgs) : ?>
    <div class="alert alert-<?php echo $type; ?>">
      <?php // This requires JS so we should add it trough JS. Progressive enhancement and stuff. ?>
      <a class="close" data-dismiss="alert">×</a>

      <?php if (!empty($msgs)) : ?>
      <h4 class="alert-heading">
        <?php echo JText::_($type); ?>
      </h4>
      <div>
        <?php foreach ($msgs as $msg) : ?>
        <div class="alert-message">
          <?php echo $msg; ?>
        </div>
        <?php endforeach; ?>
      </div>
      <?php endif; ?>
    </div>
    <?php endforeach; ?>
  </div>
  <?php endif; ?>
</div>

【讨论】:

  • 谢谢。我检查了代码,我发现了另一个谜团。按摩从哪里来的 $msgList = $displayData['msgList']。这是怎么产生的?
  • 试试 /libraries/joomla/document/renderer/html/message.php
【解决方案2】:

您可以在/template/(your_template)/css/template.css 修复模板 CSS 或者您可以使用/template/(your_template)/css/my.css 制作新的 CSS 并将其包含在/template/(your_template)/index.php:

$doc->addStyleSheetVersion($this->baseurl . '/templates/' . $this->template . '/css/my.css');

如果您需要从 CSS 中临时覆盖 CSS 类,您可以在 CSS 文件中对被覆盖的属性使用“!important”。

【讨论】:

    猜你喜欢
    • 2013-08-28
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    • 2014-11-17
    • 1970-01-01
    相关资源
    最近更新 更多