andersundsehr/ssi-include 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andersundsehr/ssi-include

Composer 安装命令:

composer require andersundsehr/ssi-include

包简介

Allows to periodically create ssi includes from anders und sehr GmbH

README 文档

README

CI codecov

EXT:ssi_include

This Extension will help you to update your Menu's and other Partials faster if they are rendered the Same over all your Pages.

It uses the SSI technique to include Partials without rendering at that moment.
It Caches the files inside typo3temp/tx_ssiinclude/ so it will reused the same partial for every request.
The Partials will be different for the site Configuration and the sys_langauge and the name you will give the Partial.

Requirements:

  • TYPO3 >=10
  • SSI enabled on Server
  • SSI errors disabled (otherwise there will be an error in your Backend)

Installation

composer req andersundsehr/ssi-include

enable SSI in webserver

You need to enable SSI on your Webserver:

Tested only with nginx. Should work with apache,

in your fastcgi part of your config:

location ~ \.php$ {
  # add next 2 lines:
  ssi on; #this must be on
  ssi_silent_errors on; #this should be on

  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $request_filename;
  fastcgi_read_timeout 600;
}

If you use staticfilecache, you should use it ♥️
you need to add the ssi config in there as well:

...

location @sfc {
  # add next 2 lines:
  ssi on; #this must be on
  ssi_silent_errors on; #this should be on

  ...

  charset utf-8;
  default_type text/html;
  try_files /typo3temp/tx_staticfilecache/https_${host}_443${uri}/index /typo3temp/tx_staticfilecache/${scheme}_${host}_${server_port}${uri}/index =405;
}

...

And now the fun part. You can replace any partial rendering with the ViewHelper s:renderInclude.
That Partial will only be rendered once every 5 minutes for the complete Site (Site Configuration Site (not Page)).
The only differentiation will be done by site config, language and the provided name.
Optionally, you can add cacheLifeTime to define the lifetime of the partial in seconds and cacheTags to invalidate the cache by flushByTags. If you include want to render the same partial with diffrent arguments it will still be the same content if you have the same name.

before:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      data-namespace-typo3-fluid="true">

<f:section name="Main">
  <div class="something something">
    <f:render partial="Menus/MainMenu" arguments="{_all}"/>
  </div>
</f:section>

after:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:s="http://typo3.org/ns/AUS/SsiInclude/ViewHelpers"
      data-namespace-typo3-fluid="true">

<f:section name="Main">
  <div class="something something">
    <s:renderInclude name="mainMenu" cacheTags="{0: 'someTag_0'}" cacheLifeTime="900" partial="Menus/MainMenu" arguments="{_all}"/>
  </div>
</f:section>

The Cache options

storeData

If you want to store the data in the cache to receive by get. This defaults to on, but if you want to spare some space you can disable it.

ssiIncludeDir

Public directory where the SSI files are stored.

Using the LazyDataProcessor to increase the Performance even more.

before:

10 = FLUIDTEMPLATE
10 {
  #...
  100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
  100 {
    #... Menu Processor Config
  }
  200 = AUS\AusProject\DataProcessing\SpecialProcessor
  #...
}

after:

10 = FLUIDTEMPLATE
10 {
  #...
  100 = AUS\SsiInclude\DataProcessing\LazyDataProcessor
  100.proxiedProcessor = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
  100.proxiedProcessor {
    #... Menu Processor Config
  }

  200 = AUS\SsiInclude\DataProcessing\LazyDataProcessor
  200.proxiedProcessor = AUS\AusProject\DataProcessing\SpecialProcessor
  200.variables = specialVar
  # the LazyDataProcessor needs to know that variable name should be proxied.
  # So we need to tell him if it is not configured inside the proxiedProcessor.as setting. 

  #...
}

Now the Setup is done 😊

with ♥️ from anders und sehr GmbH

If something did not work 😮
or you appreciate this Extension 🥰 let us know.

We are hiring https://www.andersundsehr.com/karriere/

andersundsehr/ssi-include 适用场景与选型建议

andersundsehr/ssi-include 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.09k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 andersundsehr/ssi-include 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 andersundsehr/ssi-include 我们能提供哪些服务?
定制开发 / 二次开发

基于 andersundsehr/ssi-include 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-02-16