News:

Wondering if this will always be free?  See why free is better.

Main Menu

2 questions about collapsing?

Started by 66osman66, June 27, 2015, 11:05:51 AM

Previous topic - Next topic

66osman66

Hello, I have two questions about collapsing (you know to the righ of the categories there is a '+' or '-'. When you click '+' it expands when you click '-' it collapses)

My first question is
How to make my categories collapsed as "default"?
It means when someone logs in they will see the categories "collapsed" ,of course when they want, they can expand them.

My second question is
How to expand or collapse categories without reloading the page?
When I click the (+), "quick reply" or " attachment and other options" areas they expand without reloading the page
However, when I do the same for categories the page reloads.

Thanks in advance

66osman66

I couldn't understand why nobody has responded  ???
Were my questions so confused that nobody could understand them?

In fact I found a mod for my first request http://custom.simplemachines.org/mods/index.php?mod=1267

However,
It works only for guests
I want the mod to work for everyone (guests and normal members)
So, I need your help
SOS !!!

Steve

Keep in mind that it is the weekend so someone who knows the answers to your questions may not be available.

Plus, your first question needs to be asked in the mod's support thread (which I see you've done) so you won't get much help in this section for it.

Hopefully, someone will be able to help you with your second question soon. :)
DO NOT pm me for support!

66osman66


Irisado

Posting the same request in the topic you're linking to is not going to assist you in receiving help more quickly.  That post has been deleted, as cross posting isn't allowed here.  Please be patient and wait for someone to respond to you in this topic :).
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

Bloc

Quote from: 66osman66 on June 27, 2015, 11:05:51 AM
Hello, I have two questions about collapsing (you know to the righ of the categories there is a '+' or '-'. When you click '+' it expands when you click '-' it collapses)

My first question is
How to make my categories collapsed as "default"?
It means when someone logs in they will see the categories "collapsed" ,of course when they want, they can expand them.

My second question is
How to expand or collapse categories without reloading the page?
When I click the (+), "quick reply" or " attachment and other options" areas they expand without reloading the page
However, when I do the same for categories the page reloads.

Thanks in advance
The reason the page reloads is because the state is saved in the database when you click the icons. SMF then look at these saved values and fetches only the expanded categories(boards within really), to save resources on the poor server. So while you could make it collapse without reloading, it would mean SMF would need to fetch all categories regardless if you have collapsed them - which is less optimal since forums tends to have a lot of categories and boards. If not, the instant expanding will not have any data within it to expand. :P

I think there are mods to remove this though, if you really need it.

66osman66

I see,
But still, I want to try
If it affects my site badly, I will remove it
Do you know which mod does what I want?
If you find a mod, please let me know.

Thank you for your response

Bloc

After a quick search it doesn't seem like there any - strange.

Anyway, the way to do it, would be to set all of your categories as non-collapsable(in each category's settings) and then add a expand/collapse function to BoardIndex.template. The first part is easy enough, but the second is trickier since SMF's own collapse function is not optimised for many instances at one single page. And you want to use something that remembers the state of each category too, so a simple js function will not do(unless it sets a cookie to remember states of course). SMF own function does both, cookies and database.

I'll see if I can make a new js function for that.

66osman66

Remembering the state of categories is not so important for me
Thank you..

Bloc

Ok, this trick will make a category be collapsed intially. When you click it, it will expand - but not remember this state once you reload the page. As long as it stays on the same page it will just toggle up and down as you like. I used different icons because I also kept the normal collapsing function which use the normal collapse images.

If you don't want users to be able to collapse "the old way"(the relaod based one) - set every category(in its settings) to "not allowed to collapse". Then only the new function/icon will show, giving you what you seek.

Attached is the changed Boardindex.template + you need to add this code to the end of your index.css:


.toggleme {
float: right;
margin: 10px 1em 0 1em;
cursor: pointer;
}
.togglecat { display: none; }
.notogglecat { display: table-row-group; }


If you need the exact code changes on Boardindex I'll list them too. Let me know.

66osman66

Thank you very much BK
I will try it

Advertisement: