Customization > Blocks and Modifications
Category Listing v1.0
Kryzen:
Category Listing
v1.0.1
Category Listing is a very simple block. This will show a block with all categories and will link to them. If no categories are available, it will say that. I hope you enjoy it. :)
Installing is very simple. Just create a new PHP code block and use this code:
--- Code: ---/**
Category Listing modification by Dr. Deejay
Module created for SimplePortal
Version 1.0.1
*/
global $smcFunc, $settings;
// Meh, we need a list!
echo '<ul class="sp_list">';
// Retrieve the categories form the database
$result = $smcFunc['db_query']('', 'SELECT *
FROM {db_prefix}categories
ORDER BY cat_order ASC', array());
// If we don't have anything do show, just say we haven't
if($smcFunc['db_num_rows']($result) == 0)
echo '
<li>No categories found</li>';
// Show them!
while($category = $smcFunc['db_fetch_assoc']($result))
{
// A simple echo...
echo '
<li>' . sp_embed_image('dot') . ' <a href="#c'.$category['id_cat'].'" class="smalltext">'.$category['name'].'</a></li>';
}
echo '</ul>';
--- End code ---
Enjoy!
Dr. Deejay
Kryzen:
Ok I know that I've promised to work on something else, but I've released 1.0.1 that uses sp_embed_image instead of html.
iobit:
Thanks for this mod, but i have this error when try to applt modify: Database error in block code. Please check the code.
iobit:
Ok i solved with this: http://simpleportal.net/index.php?topic=12146.msg61116#msg61116
but now i have another problem when click on category, nothing happens
Kryzen:
Glad to hear you solved your problem. :)
--- Quote from: iobit on February 08, 2013, 04:21:25 PM ---but now i have another problem when click on category, nothing happens
--- End quote ---
It only works on the boardindex (where the categories and boards are).
The code is really simple, though. It assumes all categories are public. I should rewrite this some day lol.
Navigation
[0] Message Index
[#] Next page
Go to full version