【问题标题】:How to start count chars avoiding <img></img> tag, but leaving it in text ? in joomla如何开始计数字符以避免 <img></img> 标签,但将其留在文本中?在 joomla
【发布时间】:2012-03-31 06:08:14
【问题描述】:

我用过这个

$item->introtext = JHtml::_('content.prepare', $item->introtext);
$item->introtext = strip_tags($item->introtext);
$item->introtext = substr($item->introtext, 0, 50);

然后只有纯文本出现没有图像..我想在img标签后计算字符,但在计算后仍然有img标签在文本中。

【问题讨论】:

    标签: php joomla


    【解决方案1】:

    您可以将&lt;img&gt;&lt;/img&gt; 及其在字符串中的位置存储在一个数组中,然后在计数后重新插入。

    【讨论】:

    • 我应该使用什么功能?并且 - 我尝试将自己的自定义字符串存储在 joomla 模块 helper.php 文件中,但在 tmpl 文件中使用时没有效果(即 echo $customstring; )
    • 如果您正在创建一个模块,请查看:stackoverflow.com/questions/4903197/…
    猜你喜欢
    • 1970-01-01
    • 2016-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-15
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    相关资源
    最近更新 更多