简体   繁体   English

树形结构+ PHP

[英]tree structure+php

I want to display a list of contents.and when i click on a particular content it should show the sub contents..like a tree structure..another requirement is all these contents are from a MYSQL database..(phpmyadmin) 我想显示一个内容列表。当我单击特定内容时,它应该显示子内容..像树形结构..另一个要求是所有这些内容都来自MYSQL数据库..(phpmyadmin)

  • I have 2 tables,table 1 contains 2 fields namely code and content name. 我有2个表,表1包含2个字段,即代码和内容名称。

  • table 2 contains 2 fields namely parent code and child code (both of these code are the same as code of table 1) 表2包含两个字段,即父代码和子代码(这两个代码都与表1的code相同)

when i click on a particular content,it should take the corresponding code from table 1 and check whether that code is there in the field 'parent code' of 2nd table.If so,take the child code,and search for the content name in table 1 and display under the parent content. 当我单击特定内容时,应从表1中获取相应的代码,并检查第二个表的“父代码”字段中是否存在该代码。如果是,请获取子代码,然后在中搜索内容名称表1并显示在父级内容下。 similarly it should go on... 同样,它应该继续...

i fetched all the contents using the code: 我使用代码获取了所有内容:

$ps=$this->Table1->find('all',
     array('fields'=>array('id','contentcode','contentname'),
    'conditions'=>$conditions)); 
$this->set('collections',$ps);

i passed it to the view.ctp, but dont know how to display 我将其传递给view.ctp,但不知道如何显示

i am using cakephp, 我正在使用cakephp,

thanks in advance.. 提前致谢..

如果是我,我只会用phplayersmenu

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM