Quantcast
Channel: PhpBB3 BBCodes
Viewing all articles
Browse latest Browse all 259

PhpBB3 Support • Frustration of the day: Adding the "collapsed" class to just one forum on the index.

$
0
0
.
I wonder if anyone has an idea for this.

Are y'all familiar with the "collapsable forum categories" ext? (Of course you are, it's an official phpbb ext.) Anyway, I'm trying to rig it up. :D

What I want to happen is to have just one particular category (f_id) to be closed as the default. People have been asking for that feature for years and the official support answer is "you can't without changing the functionality" blah, blah, blah.

I've thought about going at it from a couple different ways: Monkeying with the template/css files, of course, or monkeying with the functions. Maybe add the "collapsed" class to that forum id, but exactly where is not clear. Also I noticed that if you collapse a forum, the cookies will remember this. So... what if you could set the cookie to default: collapsed for that f_id?

Well I never did find a solution and I moved on to other things (bugs etc). Now I find myself (AGAIN, on this new website) really wanting a single forum to be collapsed on page-load. So I've been going through every file in the ext, trying to gain insight on what I could possibly change to make this happen.

So far I see a couple opportunities to make this happen.

Complicating the matter is in [forumlist_body.html] all the forums seem to run in an invisible list (you know what I mean) and I can't just go to that one and manually call it to default closed. Somehow I'm going to have to get the code to make the designation based on f_id.

I came across this in [listener.php]:

Code:

public function show_collapsible_categories($event){$fid = 'fid_' . $event['row']['forum_id'];$row = isset($event['cat_row']) ? 'cat_row' : 'forum_row';$event_row = $event[$row];$event_row = array_merge($event_row, array('S_FORUM_HIDDEN'=> $this->operator->is_collapsed($fid),'U_COLLAPSE_URL'=> $this->operator->get_collapsible_link($fid),));$event[$row] = $event_row;}}
Maybe this is an opportunity to designate f=27 (for example) to start out as closed. But... yeah I don't know how or what to google to find out.

Then there's this in [main_interface.php]:

Code:

interface main_interface{/** * This method processes AJAX requests for collapsible categories * when a user collapses/expands a category. Collapsed categories * will be stored to the user's db and cookie. Expanded categories * will be removed from the user's db and cookie. * * @param string $forum_id A forum identifier * * @throws \phpbb\exception\http_exception An http exception * @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JSON Response object */public function handle($forum_id);}
Maybe there's room in there to somehow set f-27 to closed.

Finally, I don't even know where to begin with the "cookie" line of opportunity.

I know it's tied to sessions. In this ext they use the term cookie, not session. There's a lot going on in [operator.php] and [operator_interface.php]. I'm not even going to quote any of it because there's too much. But this looks like a great opportunity to somewhere apply the "collapsed" class to "f_id=27."

What exactly is the "collapsed" class? A search of the entire phpbb folder yields a lot of "toggle" results but IDK if that's for the nav tabs. Searches for "class" inside the ext folder yields a lot of results but not what I expected. Very similar to the above functions.

Anyway.... this is my "frustration" of the moment.

If anyone has ideas I'd love to hear them. I'd like to reciprocate of you have any bugs that need fresh eyes. I don't think I'm as skilled as you all are but I've tinkered around A LOT and I'm willing to try.

Thanks

Statistics: Posted by pxdetroit — Today, 18:55



Viewing all articles
Browse latest Browse all 259

Trending Articles