Posted in site documentation
6777
3:57 am, June 14, 2021
 

Comments Listing should be a custom list rather than using search

For some reason when i listed the comments under posts on this site, i used the search function and then searched for the related uid, which maybe was easier at the time than adding an additional category to search.

When I did this it also recorded the uid in the search results which is annoying. 

Now i need to change the list order on the comments and i cant as it will effect search so i need to redo it now anyway. So i should have just added an additional list type in the first place.

Current Search Code

PHP

if($comments_view_enabled) {
  /* rather than doing a search here it should be doing a comment list */
    $comments_list = $comments->list_all(
            $start = 0,
            $max = 200,
            $list_type = "search",
            $template_file = "related_discussions-full-list-item.html",
            $search_term = $class->uid
        );
        //$template->set("related_discussions",$related_discussions);
        $page_content .= $comments_list;
}

Added a custom list, not sure why i didnt just do this, as its quite easy. 

PHP

if($list_type == "comments") {
        $sql = "select * from $db_table_name where linked_uid = '$search_term' order by insdate asc limit $start,$max";
}

then just changed the listing type to comments rather than search

PHP

if($comments_view_enabled) {
  $comments_list = $comments->list_all(
            $start = 0,
            $max = 200,
            $list_type = "comments",
            $template_file = "related_discussions-full-list-item.html",
            $search_term = $class->uid
        );
      $page_content .= $comments_list;
}

View Statistics
This Week
122
This Month
615
This Year
884

No Items Found.

Add Comment
Type in a Nick Name here
 
Related Search Terms
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
In this case my anchor this week becomes driving almost 2hrs outside of Atlanta to one of my favorite hard core gyms in the world.. MetroFlex aka The Dungeon. The gym owners turn the heat way up so it becomes a fun sweat box and the gym members just watch from afar and leave me alone. I happily drive myself long distances to find MY ANCHOR. Our anchor allows us to have balance, focus and be as productive as possible. And if you're in the middle of a heavy set and your headphones start to fall off your head, like mine did here.. well.. f*ck the headphones. Let em break and fall. You can always get a new pair, but the iron ain't ever gonna lift itself.
Unknown
Random CSS Property

<easing-function>

The <easing-function> CSS data type denotes a mathematical function that describes the rate at which a numerical value changes.
cubic-bezier() css reference