delboy1978uk/bone-view
Composer 安装命令:
composer require delboy1978uk/bone-view
包简介
View package for Bone Framework
README 文档
README
View package for Bone Framework
installation
Bone View is a core dependency of Bone Framework, you install Bone via the skeleton project delboy1978uk/bonemvc
usage
bone-view uses league/plates as its view engine, see the docs for that. To get an instance of the view engine from
the dependency injection container, call $container->get(ViewEngine::class). You can also simply extend Bone\Controller\Controller
and pass through Init::controller($controller) to get a ViewEngine injected in your class instance.
layouts
Your app by default has layouts in src/App/View/layouts. You can switch layouts in your controller by adding a
layout header to your response like so:
return $response->withHeader('layout', 'layouts::your-template');
view extensions
alert box
From a view file, you can call
$this->alertBox($messages);
where messages is an array of variable length, but the last
is the bootstrap alert-* class, so a value like info, danger, warning, success, etc.
view helpers
alert box
The view extension just calls this class Bone\View\Helper\AlertBox, but you can instantiate it and call it yourself.
$alert = new \Bone\View\Helper\AlertBox(); echo $alert->alertBox(['Great success!', 'success']);
Paginator
This should be moved into its own package (imho), however this will render bootstrap compatible paginator nav HTML.
<?php $viewHelper = new \Bone\View\Helper\Paginator(); $viewHelper->setCurrentPage(3); // this number will come from the url $viewHelper->setUrl('/some/page/:number'); // this is the url you are generating $viewHelper->setUrlPart(':number'); // this is the part of the url you will replace with the page number $viewHelper->setPageCount(10); // this is the total number of pages $viewHelper->setPageCountByTotalRecords(50, 10); // Or pass in a row count and num per page to set page count $viewHelper->setPagerSize(5); // this is the number of pages directly clickable in the generated pager $pagination = $viewHelper->render();
delboy1978uk/bone-view 适用场景与选型建议
delboy1978uk/bone-view 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 4.13k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 delboy1978uk/bone-view 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 delboy1978uk/bone-view 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-01