mouf/html.template.mouftemplate

此包包含Mouf管理界面的模板。内容会自动调整以适应网站页面的全宽度。无论如何,如果您喜欢,也可以使用这个组件作为模型。

v2.1.0 2022-12-08 15:26 UTC

This package is auto-updated.

Last update: 2024-09-08 19:46:22 UTC


README

MoufTemplate是用于Mouf项目的HTML模板。

它显然是一个Mouf包,并扩展了Mouf TemplateInterface。这意味着如果您使用Mouf,您可以在需要实现TemplateInterface的模板的地方使用MoufTemplate。

MoufTemplate有5个区域:内容顶部左侧右侧底部。使用Mouf UI填写这些区域。

以下是一个示例代码

<?php 
// Let's import all required classes
use Mouf\Html\Template\MoufTemplate\MoufTemplate;
use Mouf\Html\HtmlElement\HtmlBlock;

define ('ROOT_URL', "/composertest/");

require_once 'vendor/autoload.php';

// WARNING! this code is only to explain the inner workings of the MoufTemplate class
// Usually, you would never create a new instance of MoufTemplate, nor would you create 
// the $contentBlock or $leftBlock variables.
// Those are created and injected by Mouf, for you.

// Let's define the main content block
$contentBlock = new HtmlBlock();
$contentBlock->addText("Hello world!");

// Let's define the left content block
$leftBlock = new HtmlBlock();
$leftBlock->addText("My left menu!");

// Let's display the template
$template = new MoufTemplate();
$template->setContent($contentBlock);
$template->setLeft($leftBlock);
$template->toHtml();