News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Collapsible Categories (for guests)

Started by viulian, June 24, 2008, 05:05:32 AM

Previous topic - Next topic

viulian

Link to Mod

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.

smldmr

hello, is this mod compatible with 1.1.8?

viulian

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 :)

sixthofmay

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.

viulian

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.

Snorge

Any chance this will be updated for 1.1.12?

viulian

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 ..

viulian

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).


viulian

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.

viulian

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.

PLAYBOY

Thank you. I wish there was an option to collapse them as default.

PLAYBOY

I installed the mod but i still cant collapse the categories as a guest. Is there an activate switch or something?

viulian

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].

PLAYBOY

I have so many categories. I wish there was an easy way to turn the option on for multiple categories at once.

cgid

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 [nofollow]) 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.

viulian

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 ?

66osman66

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.

Steve

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.
DO NOT pm me for support!

66osman66

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

Advertisement: