zuborawka/cakephp-thread-utility 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zuborawka/cakephp-thread-utility

Composer 安装命令:

composer require zuborawka/cakephp-thread-utility

包简介

Utility class to handle threaded data which genereted by CakePHP Model::find('threaded')

README 文档

README

Utility class to handle threaded data generated by CakePHP Model::find('threaded')

http://blog.xao.jp/blog/cakephp/reconstruct-threaded-data-to-table-rows/

Usage

in CategoriesController

// Category model acts as Tree

$threaded = $this->Category->find('threaded');
$tableRows = ThreadUtility::threadToRows($threaded);

in view

<table>
  <tbody>
  <?php
  foreach ($tableRows as $tableRow):
    ?>
    <tr>
    <?php
    foreach ($tableRow as $tableCell):
      $colspan = $tableCell['colspan'] > 1 ? ' colspan="' . $tableCell['colspan'] . '"' : '';
      $rowspan = $tableCell['rowspan'] > 1 ? ' rowspan="' . $tableCell['rowspan'] . '"' : '';
      $name = h($tableCell['Category']['name']);
      printf('<td%s%s>%s</td>', $colspan, $rowspan, $name);
    endforeach;
    ?>
    </tr>
    <?php
  endforeach;
  ?>
  </tbody>
</table>

an example of output

<table>
  <tbody>
    <tr>
      <td rowspan="2">Music</td>
      <td>Pops</td>
    </tr>
    <tr>
      <td>Jazz</td>
    </tr>
    <tr>
      <td colspan="2">Architecture</td>
    </tr>
    <tr>
      <td>Food</td>
      <td>Pasta</td>
    </tr>
  </tbody>
</table>
Music Pops
Jazz
Architecture
Food Pasta

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固