unl/php-wdn-templates

用于渲染UNL模板的PHP库

v5.3.6 2024-07-11 18:50 UTC

This package is auto-updated.

Last update: 2024-09-11 19:15:06 UTC


README

Build Status Coverage Status

UNL HTML模板作为PHP库

此包允许您使用PHP对象渲染UNL模板风格的页面。

要求

  • PHP >= 5.5

示例

  • 导航到您的网站根目录
  • 创建一个 composer.json 文件,包含以下内容
{
  "require": {
    "unl/php-wdn-templates": "5.1.*"
  }
}
  • 运行以下命令
curl -sS https://getcomposer.org/installer | php
php composer.phar install
  • 创建一个 index.php 文件,包含以下内容
<?php

require_once  'vendor/autoload.php';

use UNL\Templates\Templates;

$page = Templates::factory('Fixed', Templates::VERSION_5_1);

$page->doctitle = '<title>My Sample UNL Site | University of Nebraska&ndash;Lincoln</title>';
$page->head = '<!-- Place optional header elements here -->';
$page->affiliation = '<a href="#">My site affiliation</a>';
$page->titlegraphic = '<a class="unl-site-title-medium" href="#">Title of my site</a>';
$page->navlinks = '<ul>
                   <li><a href="./">Home</a>
                       <ul>
                       <li><a href="./">Sub-link 1</a></li>
                       <li><a href="./">Sub-link 2</a></li>
                       </ul>
                   </li>
                   </ul>';
$page->hero = '<div class="dcf-hero dcf-hero-default"></div>';
$page->breadcrumbs = '<ol>
                      <li><a href="http://www.unl.edu/">UNL</a></li>
                      <li><a href="./">My Sample UNL Site</a></li>
                      </ol>';
$page->pagetitle = '<h1>Welcome</h1>';
$page->herogroup1 = '';
$page->herogroup2 = '<div class="dcf-hero-group-2"></div>';
$page->maincontentarea = '<p>Content</p>';
$page->contactinfo = '<p><strong>University of Nebraska-Lincoln</strong><br />
                      1400 R Street<br />
                      Lincoln, NE 68588<br />
                     402-472-7211</p>';
$page->jsbody = '<!-- put your custom javascript here -->';

echo $page;