swishdigital/template-selector 问题修复 & 功能扩展

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

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

swishdigital/template-selector

Composer 安装命令:

composer require swishdigital/template-selector

包简介

A fieldtype that allows you to select a template from a dropdown.

README 文档

README

A fieldtype that allows you to select a template from a dropdown.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later, Craft CMS ^4.0.0-alpha.1, or Craft CMS ^5.0.x-dev or later.

Please note this plugin requires PHP 8.x.

Installation

To install the plugin, select and install the plugin from the Craft Plugin Store, or follow these instructions:

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require swishdigital/template-selector
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Template Selector.

Migrating from Template Select plugin by Siperbig

  1. Remove the Template Select plugin without changing any attributes of your fields.

  2. Uninstall the Template Select plugin.

  3. Install Template Selector. All of your fields will continue to work and data from the provious fieldtype will remain intact.

Configuring Template Selector

Create a new field and choose field type Template Selector.

In the field settings, you can limit the list of available templates to a subfolder of the Craft templates folder. The path is relative, i.e. subfolder/anotherfolder. This may also be set to an ENV variable.

Screenshot

Screenshot

In the field settings, you can choose to make the template names more user friendly. In the field, file extensions will be removed, and the file names properly capitalized and spaced for readability.

Screenshot

Screenshot

Using Template Selector

Output the chosen template name:

{{ entry.fieldHandle }}

Include/Embed the chosen template:

{% include entry.fieldHandle %} or {% include 'myFolder/anotherFolder/' ~ entry.fieldHandle %}

Output the subfolder name:

{{ craft.templateSelector.subfolder('fieldHandle') }}

Include/Embed more dynamically:

{% include craft.templateSelector.subfolder('fieldHandle') ~ '/' ~ entry.fieldHandle %}

More Info

Brought to you by Swish Digital

This is an updated and enhanced version of the Template Select plugin by Superbig

swishdigital/template-selector 适用场景与选型建议

swishdigital/template-selector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.53k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「Craft」 「craftcms」 「craft-plugin」 「template selector」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 swishdigital/template-selector 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-23