Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: viulian on June 24, 2008, 05:05:32 AM

Title: Collapsible Categories (for guests)
Post by: viulian on June 24, 2008, 05:05:32 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1267)

This mod allows you to set any of the categories to a default 'collapsed' state and might reduce the bounce rate you have on the first page. Guests are able to expand those categories, and the last expanded/collapsed state of the category / categories will be remembered throughout their session. For normal users, everything happens as before, and the expanded/collapsed state of each category is not touched.
Search engines will not see the boards contained in the categories you have collapsed, but by this time you should have already added some kind of site map if the forum big enough that some categories have to be collapsed.
Title: Re: Collapsible Categories (for guests)
Post by: smldmr on April 01, 2009, 08:37:34 AM
hello, is this mod compatible with 1.1.8?
Title: Re: Collapsible Categories (for guests)
Post by: viulian on April 01, 2009, 12:58:25 PM
I've just uploaded a version which is:
http://custom.simplemachines.org/mods/index.php?mod=1267 version 1.0.3

(its the same code, but the .xml files needed to be updated to support the newer version).

Thank you for letting me know :)
Title: Re: Collapsible Categories (for guests)
Post by: sixthofmay on April 14, 2009, 11:12:03 PM
Nice mod :)
One thing missing though is that the category name link doesn't expand or collapse the category as a guest (it does when one is registered). Only the +- graphic link does. Which may make visitors think the category is empty if they only click the name link...

In Sources/BoardIndex.php, after installing the mod, find (line 117 on a clean SMF 1.18 install, v1.03 mod):
$context['categories'][$row_board['ID_CAT']]['collapse_image'] = '<img src="' . $settings['images_url'] . '/' . ($session_flag > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />';

And add this line after:
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($context['categories'][$row_board['ID_CAT']]['can_collapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';

I only first saw the PHP language and SMF yesterday, so not sure if the syntax is the simplest, but it works on my test install.
Title: Re: Collapsible Categories (for guests)
Post by: viulian on April 15, 2009, 01:47:04 AM
Ha :) good finding!
It never crossed my mind, I would always use the + and - to collapse.
Thank you for the tip, I have to go to work, but I'll fix the behaviour tonight once I get back.
Title: Re: Collapsible Categories (for guests)
Post by: Snorge on January 04, 2011, 12:43:34 AM
Any chance this will be updated for 1.1.12?
Title: Re: Collapsible Categories (for guests)
Post by: viulian on January 04, 2011, 11:15:09 AM
I think the plugin already works for 1.1.12 (since I upgraded the forum and still works). I will upload a newer version tonight ..
Title: Re: Collapsible Categories (for guests)
Post by: viulian on January 10, 2011, 04:32:48 AM
I have updated the package to version 1.0.5, which now only works for SMF 1.1.12.

This is due to additional URL argument required by SMF 1.1.12 so 1.0.5 version is not backwards compatible with SMF 1.1.9 or older.
For those, please use version 1.0.4 of the mod (nothing else is changed beside the additional sesc argument in the expand category '+' sign link).
Title: Re: Collapsible Categories (for guests)
Post by: PLAYBOY on January 13, 2012, 03:26:09 AM
Need update for 2.0
Title: Re: Collapsible Categories (for guests)
Post by: viulian on January 13, 2012, 03:47:18 AM
Ok will investigate :)
It took me a lot of time to jump ship to SMF 2.0 and thus I had no need for collapsible categories.
Title: Re: Collapsible Categories (for guests)
Post by: viulian on February 08, 2012, 06:58:54 PM
I have upgraded the mod to run for SMF 2.0.2. Please use "collapsible categories 2.0.1.zip" for SMF 2.0.2.
Title: Re: Collapsible Categories (for guests)
Post by: PLAYBOY on February 09, 2012, 05:37:44 AM
Thank you. I wish there was an option to collapse them as default.
Title: Re: Collapsible Categories (for guests)
Post by: PLAYBOY on February 10, 2012, 07:06:35 AM
I installed the mod but i still cant collapse the categories as a guest. Is there an activate switch or something?
Title: Re: Collapsible Categories (for guests)
Post by: viulian on February 11, 2012, 02:34:42 AM
In case you did not find it yet :

Usage
(you should probably select the text below and put it in a text editor, so you can have it after the mod is installed)

Go to Forum-> Boards and for each category (not board!), clicking on the (modify) link will open the "Edit Category" form. For each category you want collapsed by default, you should check the "Collapsed by default" checkbox, and then click on "Modify".

After putting one or more categories to "collapsed by default", you should Logout and attempt to see the main page as a guest [you might need to also close and restart the browser for the session to be discarded].
Title: Re: Collapsible Categories (for guests)
Post by: PLAYBOY on February 11, 2012, 05:33:49 AM
I have so many categories. I wish there was an easy way to turn the option on for multiple categories at once.
Title: Re: Collapsible Categories (for guests)
Post by: cgid on December 07, 2013, 03:10:45 AM
Hi,

Just in case you are still 'working' on this MOD...

I installed it and it works fine with me.
But then I found out that when I promoted my site in an email (visit www.websitename.com) something went wrong.
When the customer clicked the link, the site opened. When clicking the closed Category to open it I get the message:

An Error Has Occurred!
Unable to verify referring url. Please go back and try again.
Back

What I found out is that this only occurs when I open my site including www.
When I open it without the www. it workes fine..!

I do not understand why and I solved it with an .htaccess file redirecting www.websitename to websitename.

Best regards and thanks for the MOD.
Title: Re: Collapsible Categories (for guests)
Post by: viulian on December 12, 2013, 02:23:43 PM
Interesting - what happens if you try to open a closed category if you access the URL directly from the browser ? Did it work in the past without the module activated ?
Title: Re: Collapsible Categories (for guests)
Post by: 66osman66 on June 28, 2015, 06:52:42 AM
Hello, does this mod do what I want?
What I want is
when someone(normal users and guests) logs into my forum they will see that the categories are "collapsed" ,of course when they want, they can expand them.
Title: Re: Collapsible Categories (for guests)
Post by: Steve on June 28, 2015, 09:08:45 AM
Quote from: 66osman66 on June 28, 2015, 06:52:42 AMHello, does this mod do what I want?

Did you read the first post?

Quote from: viulian on June 24, 2008, 05:05:32 AMFor normal users, everything happens as before, and the expanded/collapsed state of each category is not touched.
Title: Re: Collapsible Categories (for guests)
Post by: 66osman66 on June 28, 2015, 10:43:00 AM
I thought the mod might be changed
So,
How can I do the same thing for normal users as well as guests?
I need guidance for this
Thanks in advance