Jump to content

JQuery FileTree and PHP


Jalz

Recommended Posts

Hi Guys,

 

I'm trying to get this tree menu http://abeautifulsite.net/notebook/58 so it displays a graphical tree from my FileMaker database. The author has provided PHP examples of a connector script, however this seems to show content from a directory folder.

 

I've written a custom php connector script which queries my database and returns the root folder in a tree structure, but I can't seem to get the 'other' folders to open up when I click on a hyperlink. Has anyone managed to successfully link this tree menu a database/MYSQL and are willing to share their secrets?

 

The code underneath is opening a subset of the same root folders for each..im confused and have no idea how I can build a tree to show all the contents within a folder.

 

The content below is what I currently have.

 

<?php
$rsContent_find = $KaziCMS->newFindCommand('CONTENT');
$rsContent_findCriterions = array('ID'=>'*',); //this is the eqivalent of your select function. Im searching for all the records that have a value in the ID field.
foreach($rsContent_findCriterions as $key=>$value) {
    $rsContent_find->AddFindCriterion($key,$value);
}

fmsSetPage($rsContent_find,'rsContent',10); 

//the above code basically finds the records, I know this works fine

<ul class="jqueryFileTree" style="display: none";>
  <?php foreach($rsContent_result->getRecords() as $rsContent_row){ ?>
      <?php 
  
  $type = $rsContent_row->getField('TYPE',0);
  
  If($type=="FOLDER"){
  echo '<li class="directory collapsed"><a href="#" rel="">'.$rsContent_row->getField('Title',0).'</a></li>';
  	} else {
  echo '<li class="file ext_ppt"><a href="#" rel="">'.$rsContent_row->getField('Title',0).'</a></li>';
  } ?>	  
    <?php } ?>
</ul>

 

The Data I have:

 

Title PI_ID Type ID

Apple 1 Folder 1

Macbook 1/5 Folder

Pro 1/5/10 File

Standard 1/5/11 File

iPhone 1/6 File

iPod 1/7 Folder

Nano 1/7/8 File

Touch 1/7/9 File

Microsoft 2 Folder 2

Applications 2/1 Folder

Office 2/1/1 File

Hardware 2/2 Folder

XBox 2/2/1 File

PHP 3 File 3

 

Hoping someone can put me right, this thread starts off promising, but the op doesn't tell us how he managed to get it working http://www.phpfreaks.com/forums/index.php/topic,233966.15.html

Link to comment
https://forums.phpfreaks.com/topic/149444-jquery-filetree-and-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.