承接 stillat/antlers-layouts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

stillat/antlers-layouts

最新稳定版本:v2.1.0

Composer 安装命令:

composer require stillat/antlers-layouts

包简介

README 文档

README

Antlers Layouts is a Statamic addon that allows you to extend arbitrary layouts and pass data to your template's layouts.

Features

This addon:

  • Allows you to extend arbitrary layouts from within your Antlers templates;
  • Pass data to layouts from templates

How to Install

You can install this addon by running the following command from your project root:

composer require stillat/antlers-layouts

How to Use

The Antlers Layouts addon provides a single layout Tag that allows you to extend arbitrary layouts and pass data to your template's layout. The recommended way to organize multiple layouts within your Statamic project is to create a new folder at the following locations to contain your extra layout templates:

resources/views/layouts/

Assuming we had a file named resources/views/layouts/custom-layout.antlers.html, we could use dynamically swap to this layout by including the following Antlers tag anywhere in our template:

{{ layout:layouts/custom-layout }}

By including this Tag, Antlers will now utilize the resources/views/layouts/custom-layout.antlers.html file as our layout instead of the normal resources/views/layout.antlers.html file.

We can use the layout:share Tag to pass data to our Antlers layout files:

{{ layout:share variable_one="Value One"
                variable_two="Another value"
                :variable_three="title" /}}

It is important to note that the layout:share Tag will only pass custom variables to the standard layout.antlers.html template file, and custom layouts located within the resources/views/layouts/ folder.

Our custom variables created using the layout:share Tag will now be available to us in our layout file like any other variable:

{{# Inside the layout template. #}}

{{ variable_one }}
{{ variable_two }}
{{ variable_three }}

License

Antlers Layouts is free software released under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-04-10