scarbous/mr_template

此包的最新版本(1.1.4)没有可用的许可证信息。

添加了使用配置文件为TS-Config和TypoScript在模板扩展中提供功能。

安装: 146

依赖: 0

建议者: 0

安全: 0

星星: 3

观察者: 1

分支: 0

开放问题: 1

类型:typo3-cms-extension

1.1.4 2022-09-25 15:23 UTC

README

CI

它做什么?

EXT:mr_template 帮助您在模板扩展中组织 TypoScript 和 TSConfig。

为什么我创建了这个扩展?

创建模板扩展时,我的目标是能够轻松重用代码,并尽可能少手动配置。

使用 Mr.Template,我可以创建基本模板并在其基础上构建。
加载所有 TypoScript 和 TSConfigs 以满足页面树相应部分的请求。(支持多页面)

如何使用?

  1. 基本上下载并安装扩展。
    建议使用 composer 安装。

  2. 使用[文件夹结构](#Folder structure)创建您的模板扩展

  3. 在您的模板扩展中创建一个 template.yml 并添加如下配置

label: Sample Template
parent: mr_template/base
typoScript:
    - EXT:fluid_styled_content/Configuration/TypoScript
    - EXT:news/Configuration/TypoScript
extensions: # Includes TypoScript in Extensions/[ExtsnsionName]/Configuration/TypoScript
    - fluid_styled_content
    - news
tsConfig: # Can handle TSConfig Files or classes wich implements Scarbous\MrTemplate\Template\Entity\TsConfigInterface
    - EXT:sample_template/Configuration/TsConfig/Page/TCEMAIN.tsconfig
  1. 定义您的 "网站根目录" 并在 "网站根目录" 中添加一个空的 TypoScript 模板。

  2. 在 "网站配置" 下的 "Mr.Template" 选项卡中选择模板

文件夹结构

为了让系统能够完成您模板扩展所需的工作,需要以下文件夹结构

sample_template
┣ Configuration
┃ ┣ MrTemplate
┃   ┣ default <- Template name, one Extension can handle multiple templates
┃   ┃ ┗ template.yml
┃   ┃
┃   ┗ TsConfig
┃     ┗ Page
┃       ┗ Mod
┃         ┗ WebLayout
┃           ┗ BackendLayouts <- Each BackendLayout get its one file.
┃             ┗ default.tsconfig
┃
┃   ┗ TypoScript <- Default TypoScript
┃     ┣ setup.txt
┃     ┗ constants.txt
┃
┣ Extensions <- Overrides for other extensions
┃ ┗ news
┃   ┗ Configuration
┃     ┗ TypoScript
┃       ┣ setup.txt
┃       ┗ constants.txt
┃
┗ Resources
  ┗ Private
    ┣ Layouts
    ┃ ┗ Page
    ┃
    ┣ Partials
    ┃ ┗ Page
    ┃
    ┗ Templates
      ┗ Page

默认 TypoScript 和 TSConfig

这里有一些我在模板扩展中经常使用的简单配置。

TypoScript

EXT:mr_template/Configuration/TypoScript/Page

基于 BackendLayout-Name 添加 FluidPage 模板。

EXT:mr_template/Configuration/TypoScript/BackendLayoutBodyClass

如文件夹名称所示,将 BackendLayout 名称作为类添加到 body 标签。

EXT:mr_template/Configuration/TypoScript/Config

一些带有可配置常量的基本配置,例如

  • caching
  • concatenateJs
  • concatenateCss
  • compressJs
  • compressCss

TSConfig

Scarbous\MrTemplate\Template\Entity\BackendLayouts

EXT:[sample_extension\]/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts 下的所有 BackendLayout 文件。