Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 11:29 am EST

Geeklog Forums

Adding topics to plg_menu_entries.


Status: offline

wimpunk

Forum User
Newbie
Registered: 06/22/05
Posts: 2
I was wondering if there's an easy way to add the topics to {plg_menu_entries}. I'm trying to find a way to do it without doing it hardcoded.
 Quote

Status: offline

wimpunk

Forum User
Newbie
Registered: 06/22/05
Posts: 2
I got an answer on the #geeklog by tokyoahead. I added this code to CUSTOM_menuEntries in lib-custom.php:
Text Formatted Code

        $sql = "SELECT * FROM ".$_TABLES['topics'].COM_getPermSQL(); # get all allowed topics

                if ($_CONF['sortmethod']=='alpha') {  # sort topics according to config.php setting
                        $sql.=' ORDER BY topic ASC;';
                } else {
                        $sql.=' ORDER BY sortnum;';
                }

        $result = DB_query($sql);

        for($i=0; $i<DB_numRows($result); $i++) # start looping through topics
        {

                $B = DB_fetchArray($result, true); # get contents of Topic

                        $myentries[] = array ('url'   => $_CONF['site_url'].'/?topic='.$B[0], # link
                                        'label' => $B[1]);
        }

 

and don't forget to add $_TABLES to the global section. I based to solution on the code on http://tokyoahead.com of the "Topic Overview & Menu Static page"-plugin.
 Quote

All times are EST. The time is now 11:29 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content