Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Generating Tree View!


My problem is simple though I am not too sure if the solution is.
I need to generate a tree view by using the data I have stored in the
database.For example in the root I have stored SportsBrand now if I
click on SportsBrand it will expand to show different names such as
Addidas,Nike,Reebok etc.Again if I click on Addidas I will have
different items such Shoes,T-shirts etc.I want to list the tree on
the left side of the screen and once the user click the items s/he
will see the related information on the right of the screen.Also if
the user want to add any new brand it will be shown dynamically under
the SportsBrand along with the items they are producing. Also if the
user want to delete any brand I have to make sure the tree structure
will be resized again.

xampp(The development IDE) is using this Tree view.

I have already progressed a bit by storeing the tree in database and
running the queries.Now I need to develop the user interface and
mapped it with the backend.

Is there any tool in PHP that will help me to do this? I think in
NETBEANS(Java IDE) they have a built in tool to generate this
structure.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
N-ary Tree
Someone knows about a php class (free)
that let me handle n-ary tree and store them
on a db?

Tree Creation?
I was wondering if anyone had any experiencing creating 'trees' from databases. IE: The navigation tree in explorer, or GMC. ANY and ALL help would be highly appreciated. I'm doing this in ASP, but I'm truly just looking for over-all methods. Thanks in advance.

Meditation upon the topic has enlightened me to the fact that my problem could also be likened to a BBS reply system that allows nested replies (reply to a reply sorta thing).

Tree Creation
i have created a visitor-logging-script that saves the visited pages into a table. The table looks like this: PHP Code:

Tree Array
I have a simple problem, but I don't found a solution for my problem.
I'm try, try and not found. If anybody help me, I very, very thankful
for this help.

Here is my problem:

I have a table with following data I have access:

page_id
page_path
page_depth
page_order
page_has_childs
page_title

I make chages add this fields to make a breadcrumbs functionality from
this system in the following fields I have stored this data:

page_id page_path page_depth page_order page_has_childs
page_title
1 x 1 0 1 Home
2 x.1 2 0 1 Products
3 x.1 2 2 0 3D Cad
9 x.1.2 3 2 0 Contact
10 x.1.2 3 0 0 Knowledge

In page path I store the location from that row data, for example in
page_id 10, I have the following path x(Home), 1(Products) and
2(Knowledge). In breadcrumbs I'm show like this Home > Products >
Knowledge.

My problem is, I need make a array tree with all data from database to
make a website map.

Implementing A Tree
I'd like to implement a tree of "tags" for a blog I'm writing for fun in PHP.
Here's what a single tag looks like:

CREATE TABLE tags
(
name varchar(30) not null default '',
id_self integer(12) not null primary key,
id_parent integer(10) not null default 0,
);
INSERT INTO tags VALUES ('root of the tree', 0, 0);

Each tag has a name, a unique id to identify itself with and a parent's id,
and all this will be stored in a database, but stored in no particular order.

I'm a little stumped as to how to reconstruct the tree. Part of the problem
is that suppose my first read to the database yeilds:

name = "physics"
id_self = 21
id_parent = 2

but further down in the database, this record exists:

name = "science"
id_self = 2
id_parent = 0

in other words, it's possible that children may be read before parents.

I've noticed that some people have implemented a tree class. Since this is
supposed to be a *fun* project for me, I'd rather write it myself. But I
find myself staring at the keyboard, not knowing how to start.

Tree Functions
I need a tree (of folders), can anyone give me some ideas/input, how
do I control collapse, explode etc?

Showing the entire tree will be too much, so I need to show a part of
it only....

Directory Tree
I need to be able to select the start location of the tree, then place it in a drop down menu... If possible, I would like to format the drop down menu too (Formating isn't a big deal, not nessesary).

Tree Structure Question.
Currently I'm using a tree like sections structure, e.g. Code:

Table: sections
+--------+------------+----------+
| sec_id | sec_parent | sec_name |
+--------+------------+----------+
| 1 | 1 | Home |
| 2 | 1 | News |
| 3 | 2 | Sports |
| 4 | 3 | Soccer |
| 5 | 4 | Teams |
| 6 | 5 | Arsenal |
| 7 | 1 | World |
| 8 | 7 | England |
| 9 | 8 | Economy |
+--------+------------+----------+

Also I'm using the function below to cover the tree: PHP Code:

Tree Data Structure
I'm facing an issue concerning tree data structure in php.
In others languages, I just need to create a root node which I bind
pointers of instances representing others nodes.
But I couldn't find a way to do so in php language. Indeed, object
instances are "volatile" reaching the end of the script. How could I
build a tree with "volatile" address pointers in php ?
I could use arrays to store data like a tree structure but I'd like to
find another way..

Counting Nodes In A Tree
I have a simple tree structure where node x can have y children.
Node x's children are stored in an array.
I want to supply a node to a function and count the TOTAL number of
children for that node.
This is what I have come up with so far:

function count_total_children($tree)
{
$num_of_c = $tree->get_num_child();
echo $num_of_c.'+'
$child_array = $tree->get_child_arr();

for($i=0;$i<$num_of_c;++$i)
{
count_total_children($child_array[$]);
}
}

Now this clearly does not work but its the closest I've come. What
this bit of code does is if a node has 5 children it will output
something like:

1+2+0+0+2+

Rather than print out the number I need to add it to a running total,
but I just cant seem to do it!

Ive tried using references but it doesnt work when you do the
recursive call?

Family Tree Approach
I've been working on a simple database for my family to keep our family tree organized.  I've written all the pages to handle inputing the data into the database, but am getting stuck on the best approach for pulling it all out into a family tree.  I want to keep things simple, so I only want it to display parents (no siblings).

However, I'd like the code to be flexible, so it will go as many generations as the database has data for.  I've looked around at a couple of other posts and came across one for a dog pedigree that is essentially the same thing, though it was limited in it's generations.  I've done a bit of research and came across this http://en.wikipedia.org/wiki/Ahnentafel  but I'm not sure if this would actually help me at all.

Right now, my mySql table is set up with an ID field, and then fields for the ID's of that entry's mother and father, along with other relevant data.  I'm basically just not sure on what the best way is to cycle through the database and pull everything out.  I'll worry about the formating later, but right now I'd like to just achieve something like this example http://en.wikipedia.org/wiki/Ahnentafel#Example.

Flash Sending Xml Tree To Php
Were having trouble reading the xml tree inside php, in the documentation it should have been posted and with sendAndLoad vars the key is the corresponding object name in flash.

So for the flash xml we have..

xmlOUT.sendAndLoad(this.path, xmlRTN);

but in php
echo $_POST['xmlOUT']; doesnt work.

Format Tree Traversal
I'm using a tree traversal to store categories.. What I want to do is use the php to format how the categories are displayed.. For example, I'm getting the depth of the node, so a result set might look like this Code:

Smarty Tree Menu
I am searching a way to make a tree menu for categories using php and smarty but as i am not very familiar with smarty syntax i cant do it with the functions i know. So here is what i have done: Code:

Url View
Is there a way using php to check what php script the user is viewing? If so how is it done?

Help Needed With Tiger Tree Hashes
I am trying to generate tiger tree hashes the same way as directconnect
does, but I am failing.

I checked the output from php with the reference vectors from
http://www.cs.technion.ac.il/~biham...ssie-format.dat
and they appear to be different!

echo bin2hex(mhash(MHASH_TIGER, 'abc'))."<br/>";
outputs
f258c1e88414ab2a527ab541ffc5b8bf935f7b951c132951
instead of
2AAB1484E8C158F2BFB8C5FF41B57A525129131C957B5F93

and, for example,
echo bin2hex(mhash(MHASH_TIGER, 'message digest'))."<br/>";
outputs
951a2078cbf881d91c441e754830cf0df6295aa51aca7f51
instead of
D981F8CB78201A950DCF3048751E441C517FCA1AA55A29F6

What am I doing wrong here?

Scanning Directory Tree - Too Slow
I wrote a recursive algorythm to scan a comlete directory structure
(2-3 levels deep) with few hundred pictures in it (i just need to store
filenames in a cache file). it's taking forewer :(. i used readdir
function. Any idea to a faster solution?

Building A Category Tree For A Selection Box?
I'm trying to create a selection box in a form which displays all categories in a database, along with indents for sub categories. Code:

Creating A Website Tree From Database
I have been given the task of creating a website tree-type diagram. I have details about web pages stored in a MySQL database. There is a reference column in the database using the format:

1.0
1.1
1.1.1
2.0
2.0.1
2.0.2
2.0.2.1

I'm sure you get the gist. What I need to do is loop through these rows in the table, outputting them in their heirarchical structure, turning this into a graphical representation in HTML.

This has me confounded from the start. I'm not sure how I would loop through these numbers in the correct order. Also, I'm not sure how I would now when I've got to the next level of numbers e.g. after looping through 1.1 - 1.6 (which should all be in the same row), how I would know that I now need to create a new row for 1.1.1, and that on this row should also be 1.6.1 --- I'm confused just writing it out.

Directory Display -- In Tree Structure
how to do a tree structure display of a directory in PHP...If the user clicks the root directory it should display only the sub-directory and the files available in that diretory..whenever the user clicks the sub-directory it should show the directory and files available in that sub directory...

Thr tree structure display shoul be dynamic ,whenever the user add's the files it should be automaticaly dect the folder..i don't want to hard code the tree structure.

Recursive Directory Tree Function
I'm trying to make a function that recursively(?) makes a directory tree. So far I can't get it working and I'm really not sure what to do. Here's what I have so far: PHP Code:

Generic MySQL/PHP Tree Schema?
Folks, any url's around re subject matter? Performance isn't
necessarily a problem, and the depth will be under, say, twenty.

Creating A Tree And Storing It In MySQL
I'm wanting to create a tree structure and store this in a database, which can then be retrieved and displayed. I'm looking to implement this with PHP and MySQL. From what I gather it is possible using a table with two or three columns: ID, Parent_ID, Description.

So if we start from the top, the leaf would have an ID of 1, and a parent_id of 0. An item down the tree would have an ID of 2, and if a child of the first, a parent_id of 1, and so forth. How would I extract this from the database? Would I get all the data and then manipulate with PHP? Presumably I need to use some kind of recursion(another thing I'm a little shaky on).

List All Sub/Sub-Sub Etc.. Categories (Category Tree)
I'm trying to list category tree, but I'm having problems listing sub-sub.. categories. This is my Category field:

+-------+----------+------+-----+---------+----------------+
| Field | Type     | Null | Key | Default | Extra          |
+-------+----------+------+-----+---------+----------------+
| ID    | int(11)  | NO   | PRI | NULL    | auto_increment |
| NAME  | longtext | YES  |     | NULL    |                |
| P_ID  | int(11)  | YES  |     | NULL    |                |
+-------+----------+------+-----+---------+----------------+

This is my code So far: Code:

Directory / File Tree With Hyperlinks
I am trying to create a page that will list a directory/file tree and allow the user to click on the filename to download the file.

I have several directories with many files in each directory.  I would like the directory names listed with no hyperlink, but the filenames listed underneath the directory name and indented a bit with a hyperlink to the file location.

I did download a directory tree script from the web and it works fairly well, but I can not figure out how to get the hyperlink functionality working.

Can anyone help me with this?

Creating A Parent->child Tree
Does anyone know any good tutorials on creating a parent->child tree?

Ive looked through google but cant seem to find any?

Windows-explorer-like Tree-folder Menu Where Available
Does anybody know where i can get an already-designed Windows-explorer-like tree-folder Menu, preferrably designed with PHP/HTML?

Files And Directories In Tree Structure Format
i need php code to display all my files and directories in a tree structured format.

Can SAX Locate A Single Note Deep Within An XML Tree?
I have an XML document that, at some points, nodes are about several
levels deep.

For example:

<?xml...
<root>
<node>
<node />
<node>
<node />
<node>
<node />
</node>
..
..
..etc

At the moment I am using DOMXML but as it requires more memory / CPU
usage I am looking into other options. I dont need to modify the XML
tree but instead locate specific nodes (navigating to next siblings,
child nodes and parent nodes) and get attribute values. Is this
possible using SAX?



Display Tree Graphically - Any Classes/algorithm?
I am looking for a class to display trees graphically (SVG, Gdlib,
whatever). It should look somehowlike this java driven example:

http://www.csupomona.edu/~jrfisher/...isualize/p2.gif

The data is stored in a Mysql dtabase.

Ajax And Mysql In Creation Of A Tree Structure
I have a page which is divided into left frame and right frame. The left frame has a tree structure, the contents of the tree structure I want it from a database. whatever new feature I am added on the right frame should get reflected on the left frame. When I want to check for some update, if I click on the any on the option from the left frame, it should appear on the right frame as non editable content.

Listing An Array Based On A Directory Tree
I have the following information stored in an SQL DB:

id -- inid -- name
1  -- 0    -- Dir1
2  -- 0    -- Dir2
3  -- 1    -- Dir3
4  -- 3    -- Dir4
5  -- 1    -- Dir5

It's basically a directory structure where "id" is the directory's id and "inid" is the directory id in which the directory is located (0 is root).

How would I go about printing this to look something like the following:

../Dir1
../../Dir3
../../../Dir4
../../Dir5
../Dir2

... I want the output to look like a proper, fully expanded directory structure of sorts!

Getting Name Of New Of View From MySQL 5.0+
We are using MySQL 5.0+ because it now supports views. However it
appears that the PHP's(4.3) mysql_field_table() is returning a
temporary name table name rather than the actual table (view) name.

For instance we have a view defined as "open_meeetings_view", yet when
we do a mysql_field_table() the name retrieved is "#sql_7a3a_1". The
same call correctly retrieves all static tables and even aliases
correctly.

It does not appear that PHP has the ability to dig any deeper (maybe in
PHP 5.0?), but does anyone know how to query MySQL for this information
directly? A "show tables" does show the view names correctly. So we
just need a way to correlate the temporary table "#sql_7a3a_1" back to
the real view name "open_meeetings_view".

View Source
I was at amazon.com and clicked on View/Source, and I got a blank page. How did they do that?

Directory-View With PHP
I've programmed an access-control via header()-function. It
checks an username and password in database ... nothing special.

Currently, the control gives access to a download, but I would
like to allow special users to view the complete directory.

AFAIK this is only possibly through ".htaccess" (Apache webserver).
But then, I need to create an entry for each user in the database
in the file :-(

Would it be possible to allow this direclty through PHP?
Of course, I could write dynamically into htaccess, but if
several users would access the file at the same time ... URGHS :-)

SQL VIEW Table
When I make a view table in mysql for as pre request from a client, does this table belongs to the this client only or all the clients who uses the server. My intension, i want to create exclusive "temp" tables for clients, where no other clients will be able to go into it.

View All Plus Pagination?
i have a online store that has about 2800+ products  - on my productList.php pages I have a few variables to display the number of products per page:

<?php
$productsPerRow = 3;
$productsPerPage = 27;my boss would like a view all button that sets $productsPerPage to the total number of products  - and is active for as long as the SESSION (Perhaps unless the button is clicked again?)

Any Ideas on the best approach to accomplish this??

PHP View Counter
How do I make a php counter, to count:

a) Total Views of one page

b) Unique views of one page

c) Use mysql with it

Executing System Files Deep In The Root Tree
I am running on an linux box with ensim webppliance. Ensim is really cool because it has a hold folder of files that perform different tasks that you would normally do from the interface. My problem is, i don't want to do them by hand, i want one of my PHP scripts to executre them and return the results. Now, there are a few problems, like you have to be root to run these scripts, cus they are in /usr/local/bin. I tried shell_exec, and exec, but I can't seem to figure out how to do this correctly.

Problem With Writing Information From PHP To LDAP-tree (labeledURI)
I am writing some LDAP-scripts in PHP. One of the scripts has to add
new objects(urls) to the tree using the ldap_add command. The problem
is that I cannot add objects of the type "labeledURIObjec" to the
tree.

The part of the script posing problems is the following one:

Algorithm For Creating A Binary Tree Genealogy For A MLM Site
Im working over a web base MLM software. I need to display a genealogy
of all the members who have joined the MLM programe. Each member
referes 2 new members and so on. Its a 2 x 2 matrix. Now i need to
calculate the total numbers of exisiting members in each leg i.e, left
leg and right leg.

Multiple Php.ini Instances - Configuration Tree Errors (PHPIniDir)
We're running multiple vhosts in an apache-2.x configuration for which
we would like to provide separate php.ini files (for different
reasons).

At the moment, we're unable to do this - the error I'm seeing is:

Starting httpd: Syntax error on line 87 of
/etc/httpd/conf/vhost.conf.admin:
Only first PHPINIDir directive honored per configuration tree -
subsequent ones ignored
[FAILED]

So my question here is in a couple of parts. One, is it even possible
to do what I'm trying to do... and what is a "configuration tree" -
does that refer to the entire instance of the apache server itself. Is
it possible to have more than one "configuration tree"s.

Refer To A File Outside The Website Tree For Downloading Purposes
I'm using Linux Redhat 8.0 (LAMP).
I have a file tx.zip , that is placed in /tmp.
Now I want people to be able to download this file without copying it to
the website tree
Can I make a reference like http://www.website.com/../../../tmp/tx.zip
if the root of my website is /var/www/html/Vwebsite ?
Due to restrictions, I cannot copy the file to /var/www/html/Vwebsite

Way To View PHP Files On Your Computer?
Is there a way to view what certain PHP files will look like, without having to upload them to your server?

I'm testing out page layouts, and its kind of a pain to upload it every time to see what it looks like.

PHP Download/view Statistics
if anyone had any ideas for a simple way that I could use to get statistics on the amount of times a webpage has been viewed? I don't really want to install a whole web statistics package.. I just want to keep track of the statistics on a few pages.

View The Picture Before Save
when i upload the picture.. is there a way we can let the user to view the picture which they just browsed before they upload>??

e.g. user need to upload 3 pictures... so when user browsed the picture... usually what we get is just the path name...instead.. i wan to view the picture and the path... but these picture are not yet upload to the folder.

See On-line View Code
Hi! Is there any possible way to view an "on-line" php file? That is of course how you can view the code in a php file?

Imap_headers Want To View Each $val Not All The $val In One String
I wish to view each item in $headers, but this script returns only an array of strings containing the items.

$headers = imap_headers ($mbox);
if ($headers == false) {
echo "Call failed<br>n"; }
else {
while (list ($key,$val) = each ($headers)) {
echo $val."<br>n"; }}

Private Client View
I would like to create a client login form for an small advertising
company.

What I need it to do is this,
1. The client logs into the website.
2. The client would see his job images.
3. he then could aprove it or send a comment back to the designer.

My question is,

1. Does anyone know of an existing project that can do this?
2. If I write it what would be the best way to present the client a
page that only will show his job.


Copyright © 2005-08 www.BigResource.com, All rights reserved