tatter/layouts 问题修复 & 功能扩展

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

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

tatter/layouts

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tatter/layouts

包简介

Layout management service for CodeIgniter 4

README 文档

README

Layout management service for CodeIgniter 4

Coverage Status

Description

This library provides a commons means of managing View Layouts across package modules and applications.

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

  • > composer require tatter/layouts

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Configuration

The code of Layouts amounts to a single config file: Tatter\Layouts\Config\Layouts. This file provides the path for each layout as a property. Initially the config file only includes a single property: "default". By supplying your own path via an App config file you can direct any package or module using Layouts to use your layout instead. For example, app/Config/Layouts.php:

<?php

namespace \Config;

class Layouts extends \Tatter\Layouts\Config\Layouts
{
	public $default = 'App\Views\project_layout';
}

Usage

To use the configured layout, simply provide the config property to your view file:

<?= $this->extend(config('Layouts')->default) ?>
<?= $this->section('main') ?>

	<p>Hellow world!</p>

<?= $this->endSection() ?>

You can use any layout name you have configured, and any name that does not match will fall back on the path supplied for "default".

See the CodeIgniter User Guide to read more on View Layouts

Layout Expectations

For consistency this library assumes that the "default" template will have the following sections:

  • headerAssets: The last section prior to the closing </head> tag, available for adding CSS tags and the like.
  • navbar: A navigation menu, typically to be displayed along the top of the page.
  • main: The main content for the page (can include nested views, etc).
  • footerASsets: The last section prior to the closing </body> tag, available for adding JS tags and footer content.

Default Layout

While it is highly recommended that you supply your own "default" layout, this library includes a generic one as a fallback. This layout is based on the Bootstrap Starter Template and includes CDN tags for Bootstrap CSS and JS. In addition to fulfilling the expectations above, the layout also accepts the following variables to configure the HTML <head> data:

  • $headerDescription
  • $headerAuthor
  • $headerTitle

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-13