Typoscript:值部分的常量

时间:2017-06-07 14:44:34

标签: constants typoscript

我有一个带有一些HTML代码的对象。我想在内部使用常量。我的代码如下:

15 = TEXT
15 {
    data = getenv : TYPO3_SITE_URL
    wrap (
        <a href="https://www.xing.com/spi/shares/new?url={data}" target="_blank"><div class="c-menu-share__item social-xing"></div></a>

        <a href="https://www.linkedin.com/shareArticle?mini=true&url={data}" target="_blank"><div class="c-menu-share__item social-linkedin"></div></a>

        <a href="https://www.facebook.com/sharer/sharer.php?u={data}" target="_blank"><div class="c-menu-share__item social-facebook"></div></a>

        <a href="mailto:?body={data}" target="_blank"><div class="c-menu-share__item social-email"></div></a>
    )
}
15.outerWrap = <div class="c-menu-share">|</div>

这不起作用。有谁能够帮我? 提前谢谢!

1 个答案:

答案 0 :(得分:0)

您无法将“数据”用作变量,但您可以直接通过{getIndpEnv : TYPO3_SITE_URL}(或{getIndpEnv : TYPO3_REQUEST_URL},如果您想要当前页面的网址)获取环境变量。试试这个:

15 = TEXT
15.value (
    <a href="https://www.xing.com/spi/shares/new?url={getIndpEnv : TYPO3_SITE_URL} " target="_blank"><div class="c-menu-share__item social-xing"></div></a>
    <a href="https://www.linkedin.com/shareArticle?mini=true&url={getIndpEnv : TYPO3_SITE_URL} " target="_blank"><div class="c-menu-share__item social-linkedin"></div></a>
    <a href="https://www.facebook.com/sharer/sharer.php?u={getIndpEnv : TYPO3_SITE_URL} " target="_blank"><div class="c-menu-share__item social-facebook"></div></a>
    <a href="mailto:?body={getIndpEnv : TYPO3_SITE_URL} " target="_blank"><div class="c-menu-share__item social-email"></div></a>
)
15.insertData = 1