View Full Version : Ajax File Tree

09-04-2008, 01:01 AM
Hi I would like to have a file tree that displays directory's on my web server, so I found this guy out there on the net.


It comes with jquery and jquery.easing scripts for directory open and close effects and also comes with pre-made server side connector scripts so you can use your server-side language of choice.

The problem how ever is after I try and run the script on my web server with the connector being PHP for my server side language (appache2.2/PHP5/MySQL5) it never works.

I get a PHP error:

Undefined variable: root on line 21

Has anyone ever gotten this script to work before and or knows what the problem with it is?


09-04-2008, 04:29 PM
i use his php file tree in a number of places. i don't use the jquery version because i run prototype and don't feel like sorting out misc conflicts between frameworks.

the guy has some nice stuff, i gotta say. works great.

anyway, it sounds like you don't have your root folder set up correctly.

09-05-2008, 01:01 AM
Hi ohgod,

Here is my code on the client side.

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Untitled Document</title>
<script src='jquery.js' type='text/javascript'></script>
<script src='jquery.easing.js' type='text/javascript'></script>
<script src='jqueryFileTree.js' type='text/javascript'></script>
<link href='jqueryFileTree.css' rel='stylesheet' type='text/css' media='screen'>
<script type='text/javascript'>

root: '/demo/',
script: 'http://localhost/application/scripts/fileTree/connectors/jqueryFileTree.php',
folderEvent: 'click',
expandSpeed: 750,
collapseSpeed: 750,
expandEasing: 'easeOutBounce',
collapseEasing: 'easeOutBounce',
loadMessage: 'Un momento...'





<div class='example'>

<div id='fileTreeDemo_3' class='demo'>


Here is a screenshot of my folder setup. Notice I infact do have a "demo/" folder that has test subfolders and images. But I still get this PHP error.


If you would like to take a look at my files for me and test this out your self PLEASE it would help me out alot!!
CLICK HERE TO DOWNLOAD MY FILES (http://www.geocities.com/ubhiceist/problemFileTree2.zip)

09-05-2008, 09:02 PM
it sounds like you don't have your root folder set up correctly

you really need to be checking this if it's displaying a directory too high...

try root: 'demo/' without the leading slash

09-06-2008, 02:43 AM
Thats just the thing I have tried every possible combination.



but nothing works. It just keeps saying error on line 21 in my php file root not defined... But if its working fine on your end, then I have to suspect that its my php install somehow.

I have never had any problems from my php before, I even run phpmyadmin for MySQL and I never get any hickups like this.

Anyways I will do further investigations.

09-06-2008, 12:44 PM
I found the problem folks!

it was my php.ini file and its error reporting enviroment.

once I changed it to:

display_errors = (E_ALL ^ E_NOTICE)

everything works perfect.

Thanks and remember when you read a Apache/PHP install tutorial and they provide a link to information on further setting up your PHP environment READ IT!