连接/smarty3-include-if-exists

Smarty v3 插件,用于在 Smarty 模板中指定子模板的条件性包含

1.1.2 2016-05-08 21:11 UTC

This package is auto-updated.

Last update: 2024-09-18 21:08:39 UTC


README

摘要

这是一个 Smarty v3 插件,用于在 Smarty 模板中指定子模板的条件性包含。

对于 Smarty v2 的类似插件,请点击此处

用法

在 Smarty 模板中使用以下语法: {include_if_exists file="foo.tpl" else="bar.tpl"}

安装

  1. 简单方法:将文件 compiler.include_if_exists.php 复制到您的 Smarty 插件目录中。
  2. 优雅的方法
    • 将文件 compiler.include_if_exists.php 放在任意文件夹中
    • 在初始化 Smarty 时添加插件目录 $smarty->addPluginsDir("your/path/to/the/files");