site documentation
Posted in
8495
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
288
This Month
1166
This Year
2602
Add Comment
Other Items in site documentation
function to load one latest item with a start val load_latest_single_num
make the view number zoom when mouse over or active
moving the hits widget into the post header and footer
for auto filled fields, need to change the text and background colours
use a list group for listing by category page [todo]
Comments Listing should be a custom list rather than using search
load the latest single item only
load oldest item based on insdate then update the insdate to now - load_latest_single_update
change this to a list group - other items
hero widget header - creates a nice looking hero item from a target uid and class
dropdown section
Latest from Code Widget
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress