vinou / site-builder
PHP 库,用于生成基于 Vinou 平台动态内容的模板化网页
Requires
- php: >=7.2
- bramus/router: *
- erusev/parsedown: ^1.7
- gumlet/php-image-resize: ^1.9
- mustangostang/spyc: ^0.5.1
- phpmailer/phpmailer: ^6.0
- s1syphos/php-simple-captcha: ^2.3
- thepixeldeveloper/sitemap: ^5.1
- twig/extensions: 1.*
- twig/twig: 2.*
- vinou/api-connector: ^3.0.0
- vinou/translations: 3.*
- dev-master
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.9.11
- 2.9.10
- 2.9.9
- 2.9.8
- 2.9.7
- 2.9.6
- 2.9.5
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.4
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-release/2.X
- dev-develop
- dev-optional_mail_delivery
- dev-optimized_captcha
- dev-#548_optimize_external_order_payment_methods
- dev-development
This package is auto-updated.
Last update: 2024-09-08 13:14:21 UTC
README
Vinou Site-Builder 是一个 PHP 库,可以轻松地将配置在 routes.yml 文件中的基本 php 路由与 Twig 模板渲染结合起来。该库还提供调用库作为数据处理程序,并将结果直接在 twig 模板中传递的功能。
目录
典型项目结构
此示例项目结构可以在 Example/Project 文件夹中的仓库内找到
安装(通过典型项目结构)
此安装指南基于我们首选的项目结构。这个结构已经发展了多年,并从许多 OSS 项目中借鉴而来。我们特别感谢多年来参与伟大的 TYPO3 社区,该社区为我们提供了丰富的知识和分享多年的想法。
1. 设置项目结构
composer require vinou/site-builder cp -R vendor/vinou/site-builder/Examples/Project/config ./ cp -R vendor/vinou/site-builder/Examples/Project/web ./
2. 修改您的安装
必需的修改!
- 在 config/settings.yml 中填写您的 Vinou AuthId 和令牌,您可以在您的 Vinou-Office 中找到它们
- 在 config/mail.yml 中填写您的邮件服务器凭据
可选但典型的修改
- 通过 Vinou 常量配置 Vinou API-Connector
- 在 config/routes.yml 中添加基本但必需的路由
路由配置
1. 一般路由参数
2. 为路由加载网站地图配置
请注意:要使用网站地图参数,您的路由必须包含变量占位符
wines/{path_segment}: template: 'Wines/detail.twig' pageTitle: 'Wine detail page' public: true sitemap: function: getWinesAll params: lazy: false pageSize: 500 dataKey: 'wines' dataProcessing: wine: getWine
3. 使用数据处理
主要原则是您可以定义一个键,该键由在特定处理程序中调用的函数的结果填充。如果没有设置处理程序,则默认使用 Vinou API-Connector。
简写提示:如果您不需要任何额外的函数配置并想调用 API-Connector 函数,可以直接使用函数名称定义键
关于葡萄酒和酒庄的简写调用示例
wines/{path_segment}: template: 'Wines/Detail.twig' pageTitle: 'wine detail page' public: true dataProcessing: wines: getWinesAll wineries: getWineriesAll
将葡萄酒和捆绑包组合到一个项目数组中的高级配置示例
wines/{path_segment}: template: 'Wines/Detail.twig' pageTitle: 'wine detail page' public: true dataProcessing: wines: getWinesAll bundles: getBundlesAll items: processor: 'formatter' function: 'mergeData' useRouteData: FALSE useData: - wines - bundles wineries: getWineriesAll
4. 注册的处理程序
5. 注册自己的处理程序
创建自己的处理程序
<?php namespace YourVendor\YourNamespace\Processors; class YourProcessor extends \Vinou\SiteBuilder\Processors\AbstractProcessor { public function dataMagic ($data = NULL) { $formattedData = $data; // transform your data here or do other stuff return $formattedData; } }
转到您的 index.php 并在 SiteBuilder 实例化之前加载处理程序
require_once __DIR__ . '/Path/to/YourProcessor.php';
然后直接在您的路由配置中使用您的处理程序
your-route-with-processor: template: 'Pages/template.twig' pageTitle: 'Page title' public: true dataProcessing: templatekey: class: '\YourVendor\YourNamespace\Processors\YourProcessor' funtion: 'dataMagic'
类列表
提供者
此库由 Vinou GmbH 开发。
Vinou GmbH
Mombacher Straße 68
55122 美因茨
E-Mail: kontakt@vinou.de
电话:+49 6131 6245390