<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 标签!模块标题?

        时间:2023-10-11

            <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 标签!模块标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:curl_setopt($ch, CURLOPT_HEADERFUNCTION, array(&amp;$thi 下一篇:使用 Ajax 查询进行 joomla 组件开发

                  相关文章

                  <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>