用不同的文本替换 <a>-tag 链接文本 [英] Replacing <a>-tag linktext with different text

查看:29
本文介绍了用不同的文本替换 <a>-tag 链接文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试映射以下 html(这是一个小 fce)..

<div data-hero="1"><h1><!-- 标题--><p><!-- 小文本--></p><p><a><span><!-- 按钮文本--></span></a></p>

映射没问题...但是当我映射 <span> 我得到一个 No content found div[1] div[1] p[2] a[1]span[1] 错误.<a>-Tag 被映射到 outter 所以它应该可以工作..

我试图实现的目标:设置一个显示在 标签中的文本,而不是链接目标本身.

这是一个使用最新 TemplaVoilà 的 TYPO3 4.7.

这是为什么?提前致谢!

编辑

@biesior 建议这是不可能的 - 所以我没有通过 Typoscript 将 包装到 标签中.

是否有机会在此中显示某些字段的内容-说:替换链接文本,以便我可以拥有单击此处了解更多... 而不是 pageXY?

顺便说一句:我使用 linkfield 而不是 Rich-Text-Editor 来设置链接.

您不能映射嵌套在先前映射元素中的任何元素.

最快的解决方案是映射 A 标签,并使用 TypoScript 用 | 包裹插入的文本.

I try to map the following html (it´s a small fce)..

<div>
    <div data-hero="1">
        <h1>
            <!-- Headline -->
        </h1>
        <p>
            <!-- Small Text -->
        </p>
        <p>
            <a>
                <span><!-- Button Text --></span>
            </a>
        </p>
    </div>
</div>

Mapping is ok... But when i map the <span> i get a No content found div[1] div[1] p[2] a[1] span[1] error. The <a>-Tag is mapped outter so it should work..

What I try to achieve: Set a Text that is displayed in the <a>-tag, instead of the link target itself.

It´s a TYPO3 4.7 using the latest TemplaVoilà.

Why is that? Thanks in advance!

Edit

@biesior suggested this is not possible - so no i wrap a <span> into the <a>-tag via Typoscript.

Is there a chance to display a certain fields content in this <span> - speak: replacing the linktext, so that i can have a Click here for more ... instead of pageXY?

Btw: I use a linkfield and not the Rich-Text-Editor for setting the link.

解决方案

You can not map any element nested in previously mapped element.

The fastest solution is mapping the A tag, and wrapping inserted text with <span>|</span> with TypoScript.

这篇关于用不同的文本替换 &lt;a&gt;-tag 链接文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆