Posted in site documentation
6353
12:02 am, June 17, 2021
 

use a list group for listing by category page [todo]

change this to a list group, should make it neater.

Page to update: https://kruxor.com/list-category/code/ 

so for some reason this is listed using this function

PHP

$list_wiki_menu = $class->list_wiki_menu();

not sure why i called it that, anyway...

here is the full function, it selects all the distinct categories and then lists all the items under each one. 

PHP

public function list_wiki_menu($mode = "widget", $start = 0, $max = 1000) {
    $out = "";
    $db_table_name = $this->db->escapeString($this->db_table_name);
    $start = $this->db->escapeString($start);
    $max = $this->db->escapeString($max);
    $db_table_name = $this->db->escapeString($this->db_table_name);
    $sql = "select distinct category from $db_table_name";
    $result =  $this->db->query($sql);
    if($result) {
        while($row = $result->fetchArray()) {
            $category = $row['category'];
            $sql_cat = "select * from $db_table_name where category = '$category' order by title asc limit $start,$max";
            $result_cat = $this->db->query($sql_cat);
            if($mode == "home") {
                $out .= "<div class='col-lg-12'>";
            }
            $out .= "<ul>$category";
            while($row_cat = $result_cat->fetchArray()) {
                $this->load_from_id($row_cat['id']);
                $nice_link = $this->generate_view_link();
                $title = $row_cat['title'];
                $out .= "<li><a href='$nice_link'>$title</a></li>";
            }
            $out .= "</ul>";
            if($mode == "home") {
                $out .= "</div>";
            }
        }
    }
    if($mode == "widget") {
        /*$out = "<h2><i class=\"far fa-file-alt\"></i> $this->nice_name</h2>$out";*/
    }
    if($mode == "home") {
        $out = "<div class='row'>$out</div>";
    }
    return $out;
}

Maybe a card style for each category with the list group inside it, something like this? i think this looks a bit neater.

View Statistics
This Week
184
This Month
617
This Year
885

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
1. Show your work to the world instead of keeping in your head💆. 2. Do the work consistently👌 3. Respect your work🥰 4. Don't postpone your work 5. Make mistakes 🔥🔥🔥
Unknown
Random CSS Property

caret-color

The caret-color CSS property sets the color of the insertion caret, the visible marker where the next character typed will be inserted. This is sometimes referred to as the text input cursor. The caret appears in elements such as <input> or those with the contenteditable attribute. The caret is typically a thin vertical line that flashes to help make it more noticeable. By default, it is black, but its color can be altered with this property.
caret-color css reference