faxity / anax-layout

该包已被废弃且不再维护。没有推荐替代包。

一个用于现代和简化布局的Anax模块。

v1.0.6 2020-01-16 16:57 UTC

This package is auto-updated.

Last update: 2021-04-16 20:13:48 UTC


README

Build Status Build Status Code Coverage Scrutinizer Code Quality

一个用于现代和简化布局的Anax模块,还包括一个不错的Flash DI模块。

安装

使用composer安装此包

composer require faxity/anax-layout

然后,您需要复制 view//config 文件夹,以及可选的 theme/ 文件夹。例如,使用rsync

mkdir view/ && rsync -av vendor/faxity/anax-layout/view view/
mkdir theme && rsync -av vendor/faxity/anax-layout/theme/ theme/

或者,如果您使用 faxity/di-sorcery 作为DI管理器,只需将 faxity/anax-layout 添加到sorcery配置文件中。

然后,您需要更新 config/page.php 文件以使用布局。正常模板可以替换如下

"layout" => [
    "region" => "layout",
    // Change here to use your own templatefile as layout
    "template" => "faxity/layout/default",
    // ..rest
],
"views" => [
    [
        "region"   => "header-logo",
        "template" => "faxity/navbar/logo",
        // ..rest
    ],
    [
        "region"   => "header",
        "template" => "faxity/navbar/header",
        // ..rest
    ],
    [
        "region"   => "header-mobile",
        "template" => "faxity/navbar/responsive",
        // ..rest
    ],
    [
        "region"   => "footer",
        "template" => "faxity/columns/default",
        // ..rest
    ],
],

Flash模块

内置的Flash模块可用于向用户显示消息。假设已正确遵循上述安装步骤,它已经安装。要使用它,只需使用

//$di is the di package manager in Anax
$di->flash->ok("ok message");
$di->flash->warn("warning message");
$di->flash->err("error message");

// The flash messages by default are set in the session for the next request
// However to set a flash message in the current request just set the second argument to true
$di->flash->ok("immediate ok message", true);
$di->flash->warn("immediate warning message", true);
$di->flash->err("immediate error message", true);

SCSS主题

此模块的 theme/ 文件夹中使用了SASS进行默认样式主题。要使用它,请按如下方式包含它

// ./vendor assuming the main .scss file is in the root folder
@import './vendor/faxity/anax-layout/theme/theme';

Navbar JavaScript代码

Navbar的JavaScript不是自动加载的,需要复制。这可以通过例如rsync轻松完成

rsync -av vendor/faxity/anax-layout/htdocs htdocs/