Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7507517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:30:10+00:00 2026-05-29T22:30:10+00:00

I need to do a tree comment system for a highload Zend framework-based web-service

  • 0

I need to do a tree comment system for a highload Zend framework-based web-service with unlimited nesting, also this system must be very fast.

Comments must be sent for Zend_View in simple array such as bellow. In Zend_View whole comments will be displayed via foreach(). Structure will be shown with CSS classes.

array(
   '0' => 'comment1 (here must be a a much of data)',
   '1' => 'comment for comment1',
   '2' => 'comment2',
   '3' => 'comment3',
   '4' => 'comment for comment3',
   '5' => 'comment of comment ^_^ '
);

Now, I can receive all comments required page from model, which sorted by date. Their structure specified below.

id | page_id | user | parent | date | text & etc

id – AI primary key

page_id – TINY int

user – int

parent – TINY int

data – timestamp

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:30:11+00:00Added an answer on May 29, 2026 at 10:30 pm

    The simplest and least optimized

    for unlimited nesting is a parent/child relationship on comment:

    Comment
    ---
    id_comment
    id_parent ALLOW NULL
    body
    ...etc
    

    To output this you would have to first select all parents (comments with a parent of NULL), then have a recursive function to select each level of children for each parent and output it. Needless to say, this is way too much overhead.

    I would suggest you look into the nested set model:

    http://en.wikipedia.org/wiki/Nested_set_model

    Using the nested set model you can select the entire tree with one query.

    I haven’t looked into this example too far, but maybe check this out: http://devzone.zend.com/1675/class-for-managing-nested-set-data/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to store a tree data structure in my database, for which I
I need to write AVL-tree with generic type in C. The best way I
I need to browse the DOM tree of a parsed HTML document. I'm using
i need to build the same source tree twice, 1 - with normal cflags
I need to be able to make a tree like structure in the appengine
I need to create an XML schema that validates a tree structure of an
I need to put an LDAP contextSource into my Java EE container's JNDI tree
I've already created the Binary Tree and Linked list classes, I'm just in need
This is the scenario: 2 Entities: tree and another tree id idParent someValue 1
I have defined a generic tree-node class like this: template<class DataType> class GenericNode {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.