简体   繁体   English

Typo3:如何在 header 和页脚中设置常用数据?

[英]Typo3: How can i set common data in header and footer like logo?

I want to set a dynamic logo for mobile and desktop versions in header footer.我想在 header 页脚中为移动和桌面版本设置动态徽标。 I want to set an email, phone number and address in the footer.我想在页脚中设置一个 email、电话号码和地址。 how can I set all data in one place?如何将所有数据设置在一个地方? Should I store every page of all data?我应该存储所有数据的每一页吗?

Check out Bootstrap Package ( https://extensions.typo3.org/extension/bootstrap_package/ ), a popular, ready-to-use TYPO3 extension that provides a responsive theme for TYPO3. Check out Bootstrap Package ( https://extensions.typo3.org/extension/bootstrap_package/ ), a popular, ready-to-use TYPO3 extension that provides a responsive theme for TYPO3. With it, you can easily customize the header and footer across all pages.有了它,您可以轻松自定义 header 和所有页面的页脚。 As the extension's name implies, it makes extensive use of the Bootstrap framework.正如扩展名所暗示的那样,它广泛使用了 Bootstrap 框架。

Constant is basically for a general setting, you can create in your base template.常量基本上用于一般设置,您可以在基本模板中创建。 However, sitepackagebuilder provides minimal setting.但是,sitepackagebuilder 提供了最少的设置。

It's pretty easy: You can create your own constant with simple code below:这很简单:您可以使用下面的简单代码创建自己的常量:

  1. Create constant, Add constant in your constant.ts (Generally file path is ext/yourExt/Configuration/TypoScript)创建常量,在你的 constant.ts 中添加常量(一般文件路径是 ext/yourExt/Configuration/TypoScript)

     plugin.tx_yourplugin { settings { # cat=plugin.tx_yourplugin/file; type=string; label=Website Logo siteLogo = } }

Now, you will find constant in your TYPO3 backend template->constant Editor module, within your extension constants.现在,您将在扩展常量中的 TYPO3 后端模板->常量编辑器模块中找到常量。

  1. Assign a value to setup.ts: Add below code in your setup.ts which is located in the same directory.为 setup.ts 分配一个值:在位于同一目录中的 setup.ts 中添加以下代码。

     plugin.tx_yourplugin { settings { siteLogo = {$plugin.tx_yourplugin.settings.siteLogo} } }

Now, your dynamic value from constant can be accessible to your fluid template or your extbase controller.现在,您的流体模板或扩展库 controller 可以访问常量的动态值。 You will find your constant in the settings user below debug.您将在调试下方的设置用户中找到您的常量。

<f:debug>{_all}</f:debug>

Here is some useful link:这是一些有用的链接:

As far as I know, a multiline constant and type file is not yet supported.据我所知,还不支持多行常量和类型file

I hope this helps!我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM