collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 543
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: Category Listing v1.0  (Read 20922 times)

0 Members and 1 Guest are viewing this topic.

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Category Listing v1.0
« on: August 09, 2011, 10:38:46 AM »
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: [Select]
/**
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>';

Enjoy!
Dr. Deejay
« Last Edit: March 31, 2012, 04:39:16 AM by Dr. Deejay »

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Category Listing v1.0
« Reply #1 on: March 31, 2012, 04:40:11 AM »
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.

Offline iobit

  • Jr. Member
  • **
  • Posts: 64
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Category Listing v1.0
« Reply #2 on: February 08, 2013, 03:27:38 PM »
Thanks for this mod, but i have this error when try to applt modify: Database error in block code. Please check the code.

Offline iobit

  • Jr. Member
  • **
  • Posts: 64
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Category Listing v1.0
« Reply #3 on: February 08, 2013, 04:21:25 PM »
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

Offline Kryzen

  • Localizer
  • Language
  • *
  • Posts: 826
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Category Listing v1.0
« Reply #4 on: February 09, 2013, 07:53:54 AM »
Glad to hear you solved your problem. :)

but now i have another problem when click on category, nothing happens
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.

Offline player.samp

  • Translator
  • *
  • Posts: 50
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Category Listing v1.0
« Reply #5 on: April 08, 2014, 12:23:05 PM »
I have an error with the database when I try to put a block like this. :(

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Category Listing v1.0
« Reply #6 on: April 08, 2014, 12:27:57 PM »
Do you get any error when you preview the block?
What error do you get when you try to save the block?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline player.samp

  • Translator
  • *
  • Posts: 50
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Category Listing v1.0
« Reply #7 on: April 08, 2014, 12:29:36 PM »
I haven't tried to Preview the block... I just try to add the block and I get an error:

"Database error in block code. Please check the code."

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Category Listing v1.0
« Reply #8 on: April 08, 2014, 12:43:20 PM »
Please try "preview block".  If "preview block"  succeeds, but you still cannot save the block, then you may need to go to Simple Portal Configuration > General > Disable PHP Validation and check that box.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline player.samp

  • Translator
  • *
  • Posts: 50
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: Category Listing v1.0
« Reply #9 on: April 08, 2014, 03:04:31 PM »
There is no error, but when I do preview, what I see on the block is just the title, but the content itself - there is nothing...

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Category Listing v1.0
« Reply #10 on: April 08, 2014, 03:44:44 PM »
Can you check the HTML actually produced?
To do this, it would be easiest to display the block on some page of your forum and save the block.
Then go look at that page.

Either there will be some kind of error message, or there will be, at a minimum,
Code: [Select]
<ul class="sp_list">
</ul>
within that block (though of course sp_list could appear in other simpleportal blocks as well).

I cannot imagine that
$result = $smcFunc['db_query']('', 'SELECT *
                            FROM {db_prefix}categories
                           ORDER BY cat_order ASC', array());

is going to give you some kind of database error, but I could be  wrong.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline USFA

  • Semi Newbie
  • *
  • Posts: 43
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Category Listing v1.0
« Reply #11 on: April 11, 2014, 10:07:11 PM »
I see the mod works, but how do you modify the contents ?
It showed links but they went no where.

Think I am not using it correctly.

Help please.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Category Listing v1.0
« Reply #12 on: April 14, 2014, 09:31:59 AM »
USFA -- this block should list all categories in your forum.
If you have no categories found, it should say that there are no categories.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline USFA

  • Semi Newbie
  • *
  • Posts: 43
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: Category Listing v1.0
« Reply #13 on: April 15, 2014, 07:37:16 PM »
Hmm it does not say anything.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Category Listing v1.0
« Reply #14 on: April 16, 2014, 06:50:28 AM »
That seems odd.

Where your block code says
Code: [Select]
if($smcFunc['db_num_rows']($result) == 0)Please try
Code: [Select]
echo '<p>number of rows: ' , $smcFunc['db_num_rows']($result), '</p>';
if($smcFunc['db_num_rows']($result) == 0)
and see what kind of output you get.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline br360

  • Semi Newbie
  • *
  • Posts: 12
  • SMF Version: 2.0.8
  • SP Version: 2.3.5
Re: Category Listing v1.0
« Reply #15 on: December 27, 2015, 07:00:20 PM »
This is is pretty cool block but I noticed that there is no way to hide certain categories from being listed. I have categories on the forum with hidden boards, all the boards are hidden in that category, yet the hidden category is still listed in this block's category list.

Is there any way to hide those categories from showing in this block?

Offline owenenene

  • Semi Newbie
  • *
  • Posts: 5
  • SMF Version: None
  • SP Version: 2.3.6
  • Elkarte Version: None
Re: Category Listing v1.0
« Reply #16 on: January 13, 2017, 02:36:51 PM »
This is is pretty cool block but I noticed that there is no way to hide certain categories from being listed. I have categories on the forum with hidden boards, all the boards are hidden in that category, yet the hidden category is still listed in this block's category list.

Is there any way to hide those categories from showing in this block?

This. Is there anyway we can hide certain categories from being shown?

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: Category Listing v1.0
« Reply #17 on: January 13, 2017, 11:14:18 PM »
As far as I am aware, only those who can access those boards can see them listed on the block