Replacing <a>-tag linktext with different text

蹲街弑〆低调 提交于 2019-12-11 19:14:25

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/13083989/replacing-a-tag-linktext-with-different-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!