TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-04-2011, 06:45 PM   #1 (permalink)
The Visitor
 
Join Date: Dec 2011
Location: Vancouver, BC
Posts: 3
Thanks: 0
mfouwaaz is on a distinguished road
Default Design question on rendering graphics

Hello php gurus

I am brand new to your forum and would like to have your expert opinions on this. I have a hierarchichal tree mapped on a database as follows:

CATEGORY_ID
CATEGORY_NAME
PARENT_ID

Some categories have PARENT_IDs and some have not. Those who have are 'children' of the PARENT_ID given. A single parent can have many children.

Now, I need to show this graphically as boxes with the category names inside them as follows:

The top categories -- those without parents will be shown as separate boxes at the top in a row. Then below each will be shown their children and then the children of each child and so on until the contents of the database table are exhausted. It will be like a christmas tree (or trees) with a box at the top branching off other boxes at lower levels.

Do you know the best way to do this?

I was intially thinking of starting off drawing the top level boxes (GD imagefilledrectangle) and then building downwards recursively. But since I would run into negative X coordinates as the tree grows wider downward, I thought of capturing all the data into an array first (coordinates and all, including negatives) and identifying the left-most coordinate (least -X) and then using that as 0 and offsetting the rest of the x coordinates by the same amount to do the actual build. It is a bit complicated but I guess it could work.

I want to store the image in the file system once it is created until there is a change in the table so it should be built as an image file. Hence, I need to also 'glue' the boxes together to form a composite picture. Lastly I have to build a image map (with hotspots) so that a particular box (category) can be selected for further action. I haven't done a complete proof of concept yet.

Now, I saw this pixel by pixel stuff and it looks kind of promising as well, but I have never worked with it. I will be very happy to hear your views of this and / or suggestions of the whole thing or parts of it or alternative ways of doing this.

Thanks
mfouwaaz is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Answer Then PHP Question codefreek The Lounge 14 07-20-2009 07:19 PM
design tips? allworknoplay General 13 05-01-2009 01:48 AM
Wanted: graphics design / animation SOCK The Lounge 0 04-12-2008 03:36 AM
Need some advice in DB design DeMo MySQL & Databases 6 01-30-2008 12:32 AM
Design (not graphical) question hostfreak General 2 12-14-2007 02:40 PM


All times are GMT. The time now is 03:11 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design