搜索 TYPO3 扩展:全局变量 [英] Searching for TYPO3 Extension: Global Variables

查看:25
本文介绍了搜索 TYPO3 扩展:全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个 TYPO3 扩展,它可以让我定义变量并在 TYPO3 后端的任何地方使用它们(类似于 %CEO_NAME%).

I am searching for a TYPO3 extension that lets me define variables and use them everywhere in the TYPO3 backend (something like %CEO_NAME%).

客户希望集中定义姓名和地址(例如为他们的 CEO),这样当另一个人得到工作时,他们只需更改一次,然后在每个 RTE、页面标题、关键字等中替换它.

The customer wants to define names and addresses (for their CEO for example) centrally, so that when another person gets the job they can just change it once and it gets replaced in every RTE, page title, keyword, etc.

是否有一些扩展可以让我轻松地做到这一点,或者是否有一种简单的方法可以通过 TS 实现?

Is there some extension that would allow me to do that easily or is there an easy way this could be achieved with TS?

如果可能的话,我想避免为此编写自己的扩展程序,因为该项目的预算有些紧张.

If at all possible I would like to avoid writing an own extension for this as the budget is somewhat tight on that project.

推荐答案

排版有一些可能性.这意味着没有编辑器可以维护替换.

There are some possibilities with typoscript. Which means no editor can maintain the replacements.

一种解决方案:最后在渲染过程中替换任何出现的:

One solution: at last in the rendering process you replace any occurence:

page = PAGE
page {
    :
    do the rendering of the page
    :
    // now replace any occurence:
    stdWrap.replacement {
        1.search = __CEO__
        1.replace = John Doe

        2.search = __COMPANY__
        2.replace = ACME
    }
}

小心选择唯一键,因为替换无处不在(在 HTML 标签中,在(内联)javascript/CSS 中,...).

Be careful to select an unique key as the replacement is done everywhere (in HTML tags, in (inline) javascript/CSS, ...).

优点:这个替换可以使用正则表达式.

Advantage: this replacement can use regular expressions.

下一步解决方案:
增强用于 textarea 字段的 parsefunc.

Next solutions:
Enhance the parsefunc, which is used for textarea fields.

tt_content.text.20 {  <- example
    parseFunc {
        constants {
            // replaces '###CEO###' with 'John Doe'
            CEO = John Doe
        }
        short {
            __CEO__ = John Doe
        }
    }
}

这将仅替换此 parseFunc 处于活动状态的字段中的标记.

This will replace the markers only in the fields this parseFunc is active.

这篇关于搜索 TYPO3 扩展:全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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