020 555 1111
  • Old fashion, modular, procedural PHP plus some scaffolding techniques to allow it to mimic MVC simplicity.
  • A quick reference to help you find in PHP maze what needs to be done and how to do it.
  • Learn a PHP Object Oriented Programming by building a live discussion forum application.
  • MVC - Model View Controller - real life, easy reference and application.
This product has options, take a look at them and select ones you like the most.
Options are displayed under image section.

Recursive data fetching, e.g.: categories and nested categories
[php functions]

 

function

function fn_tree1(
        $parent_post = '0', 		//parent post to given post tree branch
        $incline = '10',  			//how far child posts slide toward right
        $order_by = 'ASC', 			//display order external (topmost) posts in discussion, sorts only by: entry_date
        $order_by_child = 'ASC', 	//display order of child posts within post branch, sorts only by: entry_date
        $discuss_id = '0', 			//future use - can fetch adds for different discussions, articles
        $posts_array = '', 			//name of array carrying data through via recursion (also can append to external array)
        $counter = '1'				//must be same as counter on the bottom (xx)
        ) {
    
	$posts_query = mysql_query("SELECT entry_id, user_id, entry_title, entry_body, entry_date, 
                                    parent_post, discuss_id, status, flag 
                                    FROM posts WHERE parent_post = '".(int)$parent_post."' AND 
                                    discuss_id = '".(int)$discuss_id."' ORDER BY entry_date ".$order_by);

	$string ='';
	while ($posts = mysql_fetch_assoc($posts_query)) {

		
		$string .= '<ul>';	
		$string .= '<li class="cls_'.$posts['parent_post'].'">';	
	
		$string .= $posts['entry_title'].' - ';
		$string .= $posts['entry_date'].' - ';
		$string .= $posts['user_id'].'<br />';
		$string .= $posts['entry_body'].'<br /><br />';

		if ($counter <= SHOW_LEVELS) {
			//call-in recursive  SHOW_LEVELS
			$string .= fn_tree1( $posts['entry_id'], 
								 $incline*$counter, 
								 $order_by = $order_by_child, 
								 $order_by_child,
								 $discuss_id, 
								 $posts_array,
								 $counter = ($counter+1) );
		}
		$string .= '</li>';	
		$string .= '</ul>';	
		$counter = 1; //(xx)
	}
	
	return $string;
}

 

usage:

$posts = fn_tree1('0', '30', 'ASC', 'ASC');
echo $posts;

 

output:

<ul>
    <li class="cls_0">post 1 - 2012-02-06 02:26:53 - 4<br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br/><br/><ul>
            <li class="cls_1">post 2 - 2012-02-06 02:27:55 - 4<br/>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br/><br/><ul>
                    <li class="cls_2">post 4 - 2012-02-06 03:49:18 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/></li></ul>
                <ul><li class="cls_2">post 5 - 2012-02-06 03:49:46 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/></li></ul>
            </li>
        </ul>
        <ul><li class="cls_1">post x1 - 2012-02-07 07:49:57 - 4<br/>Curabitur faucibus cursus nisi, sed aliquam mauris egestas vel.<br/><br/><ul>
                    <li class="cls_9">post x2 - 2012-02-07 07:50:16 - 4<br/>Curabitur faucibus cursus nisi, sed aliquam mauris egestas vel.<br/><br/></li></ul>
                <ul><li class="cls_9">post x3 - 2012-02-07 07:50:32 - 4<br/>Curabitur faucibus cursus nisi, sed aliquam mauris egestas vel.<br/><br/></li></ul>
            </li>
        </ul>
    </li>
</ul>
<ul><li class="cls_0">post 3 - 2012-02-06 03:48:50 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/><ul>
            <li class="cls_3">post a1 - 2012-02-07 05:10:17 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/><ul>
                    <li class="cls_6">post b1 - 2012-02-07 05:10:33 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/></li></ul>
                <ul><li class="cls_6">post b2 - 2012-02-07 05:10:45 - 4<br/>Suspendisse massa nisi, blandit a fermentum quis, ultrices in massa.<br/><br/></li></ul>
            </li>
        </ul>
    </li>
</ul>

 

downloads:

database table