•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,611 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,441 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 868 | Replies: 1 | Solved
![]() |
•
•
Join Date: Jan 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
hi there,
I need a hand with recursion in php.
I've this array:
I need to get a front page with every of those entries, but the ones that have no parent_id set or 0 need to be in <td> in a table, when the cycle encounters a child (parent_id > 0) need to break the cycle, make an h2 with this parent and then again make a table with their children, when this encounter another parent_id > 0 h2 and then table again, so I can have infinite n-tree recursion.
can somebody please help me out with a parser that generates html like this?
thanks
I need a hand with recursion in php.
I've this array:
[Forum] => Array
(
[0] => Array
(
[id] => 12
[forum_category_id] => 2
[parent_id] => 0
[forum_post_id] => 0
[name] => PHP
[description] =>
[url] => php
[topics] => 0
[posts] => 0
[order] => 0
[topics_per_page] => 20
[ForumLastPost] =>
)
[1] => Array
(
[id] => 15
[forum_category_id] => 2
[parent_id] => 0
[forum_post_id] => 0
[name] => ASP.NET
[description] =>
[url] => asp_net
[topics] => 0
[posts] => 0
[order] => 0
[topics_per_page] => 20
[ForumLastPost] =>
)
[...]
[7] => Array
(
[id] => 21
[forum_category_id] => 2
[parent_id] => 0
[forum_post_id] => 0
[name] => Databases
[description] =>
[url] => databases
[topics] => 0
[posts] => 0
[order] => 0
[topics_per_page] => 20
[ForumLastPost] =>
)
[8] => Array
(
[id] => 22
[forum_category_id] => 2
[parent_id] => 21
[forum_post_id] => 0
[name] => MySQL
[description] =>
[url] => mysql
[topics] => 0
[posts] => 0
[order] => 0
[topics_per_page] => 20
[ForumLastPost] =>
)
[9] => Array
(
[id] => 23
[forum_category_id] => 2
[parent_id] => 21
[forum_post_id] => 0
[name] => SQLite
[description] =>
[url] => ms_sql
[topics] => 0
[posts] => 0
[order] => 1
[topics_per_page] => 20
[ForumLastPost] =>
)
[10] => Array
(
[id] => 24
[forum_category_id] => 2
[parent_id] => 23
[forum_post_id] => 0
[name] => 2000
[description] => SQL Server 2000
[url] => sql_server_2000
[topics] => 0
[posts] => 0
[order] => 1
[topics_per_page] => 20
[ForumLastPost] =>
)
)I need to get a front page with every of those entries, but the ones that have no parent_id set or 0 need to be in <td> in a table, when the cycle encounters a child (parent_id > 0) need to break the cycle, make an h2 with this parent and then again make a table with their children, when this encounter another parent_id > 0 h2 and then table again, so I can have infinite n-tree recursion.
can somebody please help me out with a parser that generates html like this?
thanks
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Recursion (C++)
- SEO "experts" scams (Search Engine Optimization)
- Need help with recursion and arrays (C++)
- powers of two, recursion. (C)
- Create menu from properties file by recursion (Java)
- Experts, consultants, invited, immediate payment. (Internet Marketing Job Offers)
- Recursion (C)
- JScript experts - HELP needed! (Java)
Other Threads in the PHP Forum
- Previous Thread: PHP Checkbox
- Next Thread: PHP Version


Linear Mode