thelia/smarty-redirection-module

安装次数: 10,852

依赖项: 2

建议者: 0

安全: 0

星标: 0

关注者: 8

分支: 0

公开问题: 0

类型:thelia-module

2.0.0 2021-03-04 09:54 UTC

This package is auto-updated.

Last update: 2024-09-20 22:25:37 UTC


README

此模块向模板添加了一个 smarty 函数,可以直接从模板重定向用户。

安装

手动

  • 将模块复制到 <thelia_root>/local/modules/ 目录,并确保模块名称为 SmartyRedirection。
  • 在 Thelia 管理面板中激活它

Composer

在主 thelia composer.json 文件中添加它

composer require thelia/smarty-redirection-module ~1.0.0

用法

您可以使用与 {url} 类似的 {redirect} 函数。此函数只有一个特定参数:status

如果没有提供此参数,其值默认为 302。否则,您可以将它设置为 301 以在模板中定义永久重定向。

示例

{if ! $foo}
    {redirect path="/anywhere"}
{/if}
{if ! $foo}
    {redirect path="/anywhere" status=301}
{/if}