<tfoot id='x5KxI'></tfoot>
  • <small id='x5KxI'></small><noframes id='x5KxI'>

      <i id='x5KxI'><tr id='x5KxI'><dt id='x5KxI'><q id='x5KxI'><span id='x5KxI'><b id='x5KxI'><form id='x5KxI'><ins id='x5KxI'></ins><ul id='x5KxI'></ul><sub id='x5KxI'></sub></form><legend id='x5KxI'></legend><bdo id='x5KxI'><pre id='x5KxI'><center id='x5KxI'></center></pre></bdo></b><th id='x5KxI'></th></span></q></dt></tr></i><div id='x5KxI'><tfoot id='x5KxI'></tfoot><dl id='x5KxI'><fieldset id='x5KxI'></fieldset></dl></div>
      • <bdo id='x5KxI'></bdo><ul id='x5KxI'></ul>

      <legend id='x5KxI'><style id='x5KxI'><dir id='x5KxI'><q id='x5KxI'></q></dir></style></legend>

        如何在 Joomla! 中插入 HTML 标签!模块标题?

        How to insert HTML tags in Joomla! module title?(如何在 Joomla! 中插入 HTML 标签!模块标题?)

            <tfoot id='H3XjT'></tfoot>
              <bdo id='H3XjT'></bdo><ul id='H3XjT'></ul>
              • <i id='H3XjT'><tr id='H3XjT'><dt id='H3XjT'><q id='H3XjT'><span id='H3XjT'><b id='H3XjT'><form id='H3XjT'><ins id='H3XjT'></ins><ul id='H3XjT'></ul><sub id='H3XjT'></sub></form><legend id='H3XjT'></legend><bdo id='H3XjT'><pre id='H3XjT'><center id='H3XjT'></center></pre></bdo></b><th id='H3XjT'></th></span></q></dt></tr></i><div id='H3XjT'><tfoot id='H3XjT'></tfoot><dl id='H3XjT'><fieldset id='H3XjT'></fieldset></dl></div>

                <small id='H3XjT'></small><noframes id='H3XjT'>

                  <legend id='H3XjT'><style id='H3XjT'><dir id='H3XjT'><q id='H3XjT'></q></dir></style></legend>

                    <tbody id='H3XjT'></tbody>
                  本文介绍了如何在 Joomla! 中插入 HTML 标签!模块标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想要做的是将一些 HTML 标签添加到我的 Joomla!模块标题.我需要这样的东西

                  一些<b>Title</b>

                  但是当我保存 !Joomla 时会修剪标题并删除所有 HTML 标签.

                  我查看了administrator/com_content,我认为它应该负责插入数据库数据,但我在那里找不到答案.

                  谁能帮我解决这个头痛问题?

                  解决方案

                  于是我找到了解决方案.它包含了之前的两个答案,所以我在这里放了一个带有正确代码的新答案.

                  首先我要说的是,这个解决方案只适用于固定数量的单词(最后一个、两个等)我只需要最后一个,所以我将发布一个包含一个单词的示例代码.

                  首先作为 SMacFadyen 我需要在我的模板 html 文件夹中创建一个新的模块结构:/templates/system/html/modules.php 文件.

                  注意:如果您不想将这个新的模块样式添加到所有模板中,而只是在其中一个模板上,您需要将 module.php 放在模板的 html 文件夹中.>

                  SMacFadyen 提供的看起来像这样:

                  function modChrome_myCustomModule($module, &$params, &$attribs){$doc =&JFactory::getDocument();$css = ".otherClass {}";$css .= ".yourClass {}";$doc->addStyleDeclaration($css);?><div><?php if ($module->showtitle != 0) : ?><h1><?php echo $module->title;?></h1><?php endif;?>//发布你的标题

                  <div><?php echo $module->content;?>//发布你的模块内容

                  <?php}

                  然后被Hanny的评论过期了>

                  $wrap_tag = 'b';$html_title = preg_replace("~Ww+s*$~", '<'.$wrap_tag.'>'.'\0'.'</'.$wrap_tag.'>', $module->title);

                  注意:$wrap_tag 变量存储您想要的标签.你可以把 b, em, u 等放在不同的结果中.

                  最后一件事是替换显示的标题,所以我替换了这段代码:

                  title;?></h1>有了这个:

                  最后的结果是这样的:

                  function modChrome_myCustomModule($module, &$params, &$attribs){$doc =&JFactory::getDocument();$css = ".otherClass {}";$css .= ".yourClass {}";$wrap_tag = 'b';$html_title = preg_replace("~Ww+s*$~", '<'.$wrap_tag.'>'.'\0'.'</'.$wrap_tag.'>', $module->title);$doc->addStyleDeclaration($css);?><div><?php if ($module->showtitle != 0) : ?><h1><?php echo $html_title;?></h1><?php endif;?>//发布你的标题

                  <div><?php echo $module->content;?>//发布你的模块内容

                  <?php}

                  感谢大家的帮助.

                  What I'm trying to do is to add some HTML tags to my Joomla! module titles. I will need something like this

                  Some <b>Title</b>
                  

                  but when I save !Joomla trims the titles and remove all HTML tags.

                  I've check the administrator/com_content, which I think should be responsible for inserting the database data, but I couldn't find the answer there.

                  Can anyone help me with this headache?

                  解决方案

                  So I found the solutions. It includes both of the previous answers, so I'm putting a new one here with the correct code.

                  First of all I need to say, that this solution works only for a fixed amount of words (last one, two, etc.) I need only to have the last one, so I will post an example code with one word.

                  First as SMacFadyen sad I needed to create a new module structure in my template html folder: /templates/system/html/modules.php file.

                  Note: If you don't want to add this new module styling to all templates, but just on one of them you need to put the module.php in your template's html folder.

                  The provided by SMacFadyen looks like this:

                  function modChrome_myCustomModule($module, &$params, &$attribs)
                  {
                  $doc =& JFactory::getDocument();
                  $css  = ".otherClass {}";
                  $css .= ".yourClass {}";
                  
                  $doc->addStyleDeclaration($css);
                  
                  ?>
                      <div>
                          <?php if ($module->showtitle != 0) : ?>
                              <h1><?php echo $module->title; ?></h1>
                      <?php endif; ?> // post your title
                      </div>
                      <div>
                           <?php echo $module->content; ?> // post your module content
                      </div>
                  
                  <?php
                  }
                  

                  Then expired by the comments of Hanny I've added some php code to match the last word of the title and to store it in a new varibale.The code looks like this:

                  $wrap_tag = 'b';
                  $html_title = preg_replace("~Ww+s*$~", '<'.$wrap_tag.'>'.'\0'.'</'.$wrap_tag.'>', $module->title);
                  

                  Note: the $wrap_tag variable stores the tag you want. You can put b, em, u and etc. to have different result.

                  The last thing was to replace the displayed title, so I've replaced this code: <h1><?php echo $module->title; ?></h1> with this one: <h1><?php echo $html_title; ?></h1>

                  The final result was this:

                  function modChrome_myCustomModule($module, &$params, &$attribs)
                  {
                  $doc =& JFactory::getDocument();
                  $css  = ".otherClass {}";
                  $css .= ".yourClass {}";
                  
                  $wrap_tag = 'b';
                  $html_title = preg_replace("~Ww+s*$~", '<'.$wrap_tag.'>'.'\0'.'</'.$wrap_tag.'>', $module->title);
                  
                  $doc->addStyleDeclaration($css);
                  
                  ?>
                      <div>
                          <?php if ($module->showtitle != 0) : ?>
                              <h1><?php echo $html_title; ?></h1>
                      <?php endif; ?> // post your title
                      </div>
                      <div>
                           <?php echo $module->content; ?> // post your module content
                      </div>
                  
                  <?php
                  }
                  

                  Thanks to everybody for the help.

                  这篇关于如何在 Joomla! 中插入 HTML 标签!模块标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <small id='CWlNb'></small><noframes id='CWlNb'>

                • <i id='CWlNb'><tr id='CWlNb'><dt id='CWlNb'><q id='CWlNb'><span id='CWlNb'><b id='CWlNb'><form id='CWlNb'><ins id='CWlNb'></ins><ul id='CWlNb'></ul><sub id='CWlNb'></sub></form><legend id='CWlNb'></legend><bdo id='CWlNb'><pre id='CWlNb'><center id='CWlNb'></center></pre></bdo></b><th id='CWlNb'></th></span></q></dt></tr></i><div id='CWlNb'><tfoot id='CWlNb'></tfoot><dl id='CWlNb'><fieldset id='CWlNb'></fieldset></dl></div>
                    <bdo id='CWlNb'></bdo><ul id='CWlNb'></ul>
                    <legend id='CWlNb'><style id='CWlNb'><dir id='CWlNb'><q id='CWlNb'></q></dir></style></legend>

                        <tbody id='CWlNb'></tbody>

                        • <tfoot id='CWlNb'></tfoot>