celtic34fr/graphic-object-templating

通过对象库构建并响应用户的 HTML5 页面

0.2.0 2020-10-09 22:12 UTC

This package is auto-updated.

Last update: 2024-09-25 23:24:27 UTC


README

图形对象模板

!!!! 注意 !!!

此版本正在进行重组 - 重新设计,文档可能不是完全最新的。如有问题,请随时联系我:Gilbert ARMENGAUD <gilbert.armengaud@gmail.com>

介绍

图形对象模板(GOT)是一个用于使用对象构建 HTML5 页面的框架。它还允许管理由此产生的交互。GOT 基于 HTML5 语义,并将其转换为对象。通过这些对象,它旨在简化互联网和内网页面的创建和管理。

GOT 实施的对象分为两种类型

  • 内容类型对象 内容:呈现,帮助获取数据
  • 容器类型对象 容器:帮助组织页面和通过其他对象呈现信息,无论其类型如何

安装

使用 composer,在项目根目录的 shell 中

composer require celtic34fr/graphic-object-templating

然后,输入以下命令

cd public

Unix

ln -s ../vendor/celtic34fr/graphic-object-templating/GraphicObjectTemplating/public ./graphicobjecttemplating

Windows

mklink .\graphicobjecttemplating ..\vendor\celtic34fr\graphic-object-templating\GraphicObjectTemplating\public

这将为 GOT 实现链接到 CSS 和 JS 资源。

您需要在模板 'layout.html.twig' 中添加以下行,以便在 head 块中调用 G.O.T. 的有用 Ajax 调用

<link href="{{ basePath() }}/graphicobjecttemplating/gotMain/css/main.css" media="screen" rel="stylesheet" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/awesome-bootstrap-checkbox/1.0.2/awesome-bootstrap-checkbox.min.css"
    media="screen" rel="stylesheet" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" media="screen"
    rel="stylesheet" type="text/css">
<script type="text/javascript" src="{{ basePath() }}/graphicobjecttemplating/gotMain/js/main.js"></script>

并且您需要在 body 块的开头添加以下两行

<div id="gotCallback" style="display: none;">{{ url("got-callback") }}</div>
<div id="divWork" style="display: none"></div>

然后我们必须在 configapplication.config.php 文件中激活模块

'ZfcTwig',
'GraphicObjectTemplating',

/view/templates 目录中包含替换 Application 模块 view 目录中现有模板的模板。在将它们复制到相应目录后,您将需要修改 Application 模块的配置文件

::
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.html.twig', 'application/index/index' => __DIR__ . '/../view/application/index/index.html.twig', 'error/404' => __DIR__ . '/../view/error/404.html.twig', 'error/index' => __DIR__ . '/../view/error/index.html.twig',

),

您还可以找到 zfctwig.local.php 文件,您需要将其复制到您项目的 config/autoload 目录中。

!!!! 注意 !!!

此版本正在重组 - 重新设计,文档可能不是完全最新的。如有问题,请随时联系我:Gilbert ARMENGAUD <gilbert.armengaud@gmail.com>

使用

要使用 GOT,首先需要使用这些对象创建页面或部分、页面文章。然后,它提供了两种生成网站、应用程序 HTML5 页面的方法

  • 使用 service 'graphic-object-templating-services',
  • 使用页面模板中的 ViewHelpers

当前可用的对象

  • ODButton:按钮(可以执行 [callback] 方法)
  • ODContent : 未类型化内容显示对象
  • ODInput : 标准输入区域 [支持:文本(text)、隐藏(hidden)和密码(password)]
  • OSDiv : HTML页面未类型化部分

开发中

  • ODSelect : 下拉列表(HTML或jQuery Select2)
  • ODCheckbox : 复选框
  • ODNotification : 屏幕消息显示(类似Windows 8风格)
  • ODTable : HTML标签对象 <table></table>
  • ODBadge : 包含文本或数字的颜色徽章