Some how, some way I figured out how to display the comments. It's a total butcher job of the code, a better programmer probably would have some elegant way to do this with recursion or something, instead I just used three for loops. But hey, it's working! Good example of comments displaying (even third tier level) is shown on this page:
http://www.stickvise.com/blog/2
Here is the new print_comments function I made to brute force the display of comments in the correct nested manner. I
// print_comments function
function print_comments($comments) {
// loop through comments array
echo '<ul>';
foreach($comments as $comment_object1) {
// find and print first tier comments
if($comment_object1['reply_to'] == 0) {
echo '
<p><a href="'.$comment_object1['user']['url'].'" target="_blank">'.$comment_object1['user']['screen_name'].'</a><br />
'.$comment_object1['comment'].'
</p>';
// loop through comments array again to find second tier comments
echo '<ul>';
foreach($comments as $comment_object2) {
// find and print second tier comments replying to the above tier comment
if($comment_object2['reply_to'] == $comment_object1['id']) {
echo '
<p><a href="'.$comment_object2['user']['url'].'" target="_blank">'.$comment_object2['user']['screen_name'].'</a><br />
'.$comment_object2['comment'].'
</p>';
// loop through comments array third time to find third tier comments
echo '<ul>';
foreach($comments as $comment_object3) {
// find and print third tier comments replying to the second tier comment
if($comment_object3['reply_to'] == $comment_object2['id']) {
echo '
<p><a href="'.$comment_object3['user']['url'].'" target="_blank">'.$comment_object3['user']['screen_name'].'</a><br />
'.$comment_object3['comment'].'
</p>';
}
}
echo '</ul>'; // end third tier comments
}
}
echo '</ul>'; // end second tier comments
}
}
echo '</ul>'; // end first tier comments
} // end print_comments()
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
<a href="http://www.clash-games.com">لعبة بادل</a>
Are you sure? yes | no
Escorts in Mumbai is one of the best in Mumbai. We are a respected escort agency in Mumbai, also known as the red light district. Our escorts provide excellent service and they are well-educated and speak English fluently. Ready to give you an unforgettable experience of your life time!
Are you sure? yes | no
If you have been trying to find Escorts in Bangalore for long and not getting any results then you are at the right place. We understand your situation because we have done this same task a lot of times before. That is why we make it our responsibility to provide an efficient and reliable escort service that can definitely bring an end to your search. With our services, you will get some of the best Bangalore escorts and other related items like accommodation which will cater to your every need.
Are you sure? yes | no
Jaipur Escorts Services gives you the experience of a lifetime. With beautiful escorts who are ready to meet your every need. Experience a sexual journey with these beauties and satisfy your Erotic wants with our escort service agency in Jaipur.
Mumbai Escorts || Escorts in Bangalore
Are you sure? yes | no
<a href="https://www.google.com">Hello Goolge</a>
[url=https://www.google.com/]Hey Google[/url]
Hello Goolge
Are you sure? yes | no