一.需求

(1)一级分类下的所有文章.

(2)文章链接跳转

(3)节点点击收缩

实现如图1.png

二、相关文档

1.jsmind文档:http://hizzgdev.github.io/jsmind/developer.html

三、实现步骤:

(1)引入静态资源,下载jsmind包,添加css和js文件,如图

(2)头部head.html 引用

(3)在app/portal/controller/Index.class.php 添加方法

use app\portal\service\ApiService;

//接口

public  function jsmind()

{

$catergeresObj=new ApiService();

$catergeres=$catergeresObj->allSubCategories(0);//获取根类下所有子分类(所有后代)

$mind_data=[

'id'=>'root',

'topic'=>'博文',

];

$arr1=array();

$arr2=array();

foreach ($catergeres as $catergery){

$catergeres_articles=$catergeresObj->articles(array('category_ids'=>$catergery['id']));//获取某个分类下所有文章

foreach ($catergeres_articles as $articles){

$data_children=[

'id'=>$catergery['name'],

'topic'=>$catergery['name'],

'direction'=>'right',

'expanded'=>'false',

];

if($catergery['id']%2==0){

$data_children['direction']='left';

}

foreach ($articles as $article){

$data_children['children']=[

'id'=>$article['id'],

'topic'=>"".$article['post_title'].""

];

array_push($arr1,$data_children['children']);

$data_children['children']=$arr1;

}

$arr1=array();

array_push($arr2,$data_children);

$mind_data['children']=$arr2;

}

}

return json($mind_data);

}

public  function mind(){

$id                  = $this->request->param('id', 0, 'intval');

$portalCategoryModel = new PortalCategoryModel();

$category = $portalCategoryModel->where('id', $id)->where('status', 1)->find();

$this->assign('category', $category);

$listTpl = empty($category['list_tpl']) ? 'list' : $category['list_tpl'];

return $this->fetch(':mind');

}

(4)在..../simpleboots添加mind.html

html>

{$category.seo_title}

$top_slide_id=empty($theme_vars['top_slide'])?1:$theme_vars['top_slide'];

{$vo.title|default=''}

$demo_time=2;

首页/最新文章

$(function () {

$("#home-slider").slippry({

transition: 'fade',

useCSS: true,

captions: false,

speed: 1000,

pause: 3000,

auto: true,

preload: 'visible'

});

});

function data(){

var minddata=$.ajax({url:"/thinkcmf-master/public/index.php/portal/index/jsmind",async:false});

var arrs=minddata.responseJSON;

console.log(arrs);

return arrs;

}

function load_jsmind(){

var mind = {

/* 元数据,定义思维导图的名称、作者、版本等信息 */

"meta":{

"name":"jsMind-demo-tree",

"author":"hizzgdev@163.com",

"version":"0.2"

},

/* 数据格式声明 */

"format":"node_tree",

/* 数据内容 */

"data":data()

};

var options = {

container:'jsmind_container',

editable:true,

theme:'primary'

};

var jm = jsMind.show(options,mind);

}

load_jsmind();

jsmind结合php,thinkCMF5与jsMind实现文章Mind版相关推荐

  1. 怎么删除CSDN上发布的文章(电脑版)

    怎么删除CSDN上发布的文章(电脑版) 第一步:回到个人主页 第二步:点击右上角的"创作中心" 第三步:点击进去之后找到"管理"--"内容管理&quo ...

  2. 英语口语-文章朗读Week10 Wednesday

    英语文章 Everyone needs sleep for survival, but how much? It is said that eight hours of sleep is fundam ...

  3. 英语口语-文章朗读Week10 Monday

    英语文章 Here are some valuable suggestions which may assist you in landing good job First, make your re ...

  4. 英语口语-文章朗读Week9 Wednesday

    英语文章 Birds of the same species flock together, People tend to look for someone like themselves to be ...

  5. 英语口语-文章朗读Week9 TuesDay

    朗读文章 People living in ancient times had no alternative but to do housework manually. They fire the w ...

  6. Kindle4RSS - 好用的Kindle RSS新闻文章推送服务

    简介:Kindle4RSS(https://kindle4rss.com/)是一个让你订阅RSS Feed新闻并定时递送到Kindle的服务,可以直接订阅该平台整理的流行的新闻源,或者订阅你喜欢的任意 ...

  7. educoder-警务大数据之精准布控

    1.第一关 1.1 mapper层 package net.educoder.mapper; import net.educoder.entity.User; import org.apache.ib ...

  8. 干掉Navicat:这个IDEA的兄弟真香!

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 DataGrip 版是由JetBrains公司推出的数据库管理软件 ...

  9. ubuntu 10.10 安装 oracle 11G

    网上参考文章: 老外版: http://www.pythian.com/news/968/installing-oracle-11g-on-ubuntu-804-lts-hardy-heron/ 国人 ...

  10. 【重置版】Android studio高效开发的秘密

    这篇算是5年前的文章重置版了(狗头),并会一直更新下去 直接干货 KeyMap 是不是经常忘记AS的快捷键,换一个平台,换一个环境,快捷键都不太一样,还得疯狂百度.NONONO,用keymap,你就是 ...

最新文章

  1. Python 自动化办公之 Excel 对比工具
  2. XPath crash course note
  3. bios显存改8g rx_【折腾】RX470矿卡刷BIOS变身记
  4. resultset rs =pst.executequery();发生异常_07795.14.4HMaster无法成为Active异常分析
  5. K8s报错#!/bin/bash yum install -y yum-utils device-mapper-persistent-data lvm2 if [ $? = 0 ];then echo
  6. Codeforces Round #743 (Div. 2) D. Xor of 3 模拟 + 构造
  7. 模板:二维凸包(计算几何)
  8. linux-2.6.32.2内核在mini2440上的移植,Linux2.6.32.2移植到Mini2440
  9. 如何看待阿里巴巴推荐的Python400集视频?零基础入门学习Python
  10. 关于【微服务】,你必须了解这些
  11. 普通电脑能做成瘦客户机吗_阿里云的“无影”云电脑,能不能真的代替传统电脑...
  12. 多线程糗事百科案例(python2)
  13. Kubernetes1.91(K8s)安装部署过程(一)--证书安装
  14. Winfrom窗体无法关闭问题--检查是否存在重写
  15. [BZOJ] 1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场
  16. 经典机器学习系列(六)【集成学习】
  17. 【转】密码经济学: 区块链技术前景之路基
  18. wowza配置rtsp/rtp播放
  19. 如何在SQL SERVER的windows身份验证添加一个SQL Server身份验证方式
  20. python中sys是什么意思_python里的sys是什么意思

热门文章

  1. Ubuntu 12 ssh 安装 终端命令 报软件依赖 错误(未解决)
  2. 基于jsp的新闻发布系统
  3. 如何用java编写五子棋_java编写五子棋
  4. Oracle优化新常态 前半生
  5. 计算机组成原理什么是模,计算机组成原理中字、位元组、位各指什么?单位用什么表示?...
  6. 如何进入大华智能分析服务器,如何配置大华录像机区域入侵功能,看完就明白...
  7. 微信机器人之PC微信hook
  8. 实现米思齐的数码管图形化编程
  9. centos7 RPM包之rpm命令
  10. 2022年十大突破性技术,“无密码”排名第一