How to limit # of forums displayed under mainpage categories, pagination, collapse ?
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #11
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-05-2012 03:09 PM)Sama34 Wrote:  Tabs only seems reasonable for rol games forums and alike, as many users who go there ofter, already know where their place is or whatnot.

Thank you for the input.
Hoping to at least try it (collapse/expand), and then decide if it works (or not) for this case.
Found some code at functions_forumlist.php...

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Check if this category is either expanded or collapsed and hide it as necessary.
[code]		$expdisplay = '';
			$collapsed_name = "cat_{$forum['fid']}_c";
			
			if(isset($collapsed[$collapsed_name]) && $collapsed[$collapsed_name] == "display: show;")

			{
				$expcolimage = "collapse_collapsed.gif";
				$expdisplay = "display: none;";
				$expaltext = "[+]";
			}
			else
			{
				$expcolimage = "collapse.gif";
				$expaltext = "[-]";
			}

Does that look like where might be able to set for collapsed display as default for when initially open homepage ?
Have changed image to make it more clear where to click, now hope to try changing code so homepage opens with category collapsed.

Ps: The only other code found is at /admin/modules/style/templates.php...

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
foreach($template_groups as $prefix => $group)
	{	
		$tmp_expand = "";
		if(in_array($group['gid'], $expand_array))
		{
			$expand = $lang->collapse;
			$expanded = true;
			
			$tmp_expand = $expand_array;
			$unsetgid = array_search($group['gid'], $tmp_expand);
			unset($tmp_expand[$unsetgid]);
			$group['expand_str'] = implode("|", $tmp_expand);
		}
		else
		{
			$expand = $lang->expand;
			$expanded = false;
			
			$group['expand_str'] = implode("|", $expand_array);
			if($group['expand_str'])
			{
				$group['expand_str'] .= "|";
			}
			$group['expand_str'] .= $group['gid'];
		}
		
		if($group['expand_str'])
		{
			$group['expand_str'] = "&expand={$group['expand_str']}";
		}
		
		if($expanded == true && isset($group['templates']) && count($group['templates']) > 0)
		{
			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
			$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));
		
			$templates = $group['templates'];
			ksort($templates);
			
			foreach($templates as $template)
			{
				$template['pretty_title'] = $template['title'];
				
				$popup = new PopupMenu("template_{$template['tid']}", $lang->options);
				$popup->add_item($lang->full_edit, "index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}{$expand_str}");
				
				if(isset($template['modified']) && $template['modified'] == true)
				{					
					if($sid > 0)
					{
						$popup->add_item($lang->diff_report, "index.php?module=style-templates&amp;action=diff_report&amp;title=".urlencode($template['title'])."&amp;sid2={$sid}");
					
						$popup->add_item($lang->revert_to_orig, "index.php?module=style-templates&amp;action=revert&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}{$expand_str}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_revertion}')");
					}
					
					$template['pretty_title'] = "<span style=\"color: green;\">{$template['title']}</span>";
				}				
				// This template does not exist in the master list
				else if(isset($template['original']) && $template['original'] == false)
				{
					$popup->add_item($lang->delete_template, "index.php?module=style-templates&amp;action=delete_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}&amp;my_post_key={$mybb->post_code}{$expand_str}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_template_deletion}')");
					
					$template['pretty_title'] = "<span style=\"color: blue;\">{$template['title']}</span>";
				}
				
				$table->construct_cell("<span style=\"padding: 20px;\"><a href=\"index.php?module=style-templates&amp;action=edit_template&amp;title=".urlencode($template['title'])."&amp;sid={$sid}{$expand_str}\" >{$template['pretty_title']}</a></span>");
				$table->construct_cell($popup->fetch(), array("class" => "align_center"));
				
				$table->construct_row();
			}
		}
		else if(isset($group['templates']) && count($group['templates']) > 0)
		{			
			$table->construct_cell("<strong><a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$group['title']}</a></strong>");
 			$table->construct_cell("<a href=\"index.php?module=style-templates&amp;sid={$sid}{$group['expand_str']}#group_{$group['gid']}\">{$expand}</a>", array("class" => "align_center"));
 			$table->construct_row(array("class" => "alt_row", "id" => "group_".$group['gid'], "name" => "group_".$group['gid']));
		}
	}
	
	$table->output($template_sets[$sid]);
	
	$page->output_footer();
}


Thanks again for your help !
(This post was last modified: 02-06-2012 03:00 PM by akm.)
02-06-2012 02:24 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #12
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-05-2012 10:56 AM)akm Wrote:  Where to start looking for info on 'tab modifications' ?

http://duckduckgo.com/?q=forum+tabs+site%3Amybb.com

My Blog
02-07-2012 10:44 AM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #13
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-07-2012 10:44 AM)ZiNgA BuRgA Wrote:  
(02-05-2012 10:56 AM)akm Wrote:  Where to start looking for info on 'tab modifications' ?
http://duckduckgo.com/?q=forum+tabs+site%3Amybb.com

Thank you for the 'tabs' info.
Am really leaning toward the 'collapse' idea.
Found a thread at MyBB...
http://community.mybb.com/archive/index....http://community.mybb.com/archive/index.php/thread-
...that think talked about using cookies for the collapse/explode thing.
Also found below code at global.php...

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// set up collapsible items (to automatically show them us expanded)
if($colcookie)
{
	$col = explode("|", $colcookie);
	if(!is_array($col))
	{
		$col[0] = $colcookie; // only one item
	}
	unset($collapsed);
	foreach($col as $key => $val)
	{
		$ex = $val."_e";
		$co = $val."_c";
		$collapsed[$co] = "display: show;";
		$collapsed[$ex] = "display: none;";
		$collapsedimg[$val] = "_collapsed";
	}
}

...which have no idea about.
Firefox lists the used cookies including 'collapse' (scrnshot attached).
Assume it is created by the above code ?
Also assume it covers all collapsible fields, so would need to somehow specify the 'categories' only to be collapsed by default.
Obviously just grasping for straws at this point.
Know very little about cookies code, period.
Does the cookie thing sound like the direction to go for the default 'category' idea ?
If so, good place to look for info on how to work with cookies code for categories (other than the above MyBB thread) ?



Attached File(s) Thumbnail(s)
   

Thanks again for your help !
02-07-2012 04:40 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #14
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
Possibly.
Cookies are designed to remember things, not set defaults, though you may be able to write some elaborate hack to do some overwriting.
But any solution is going to be ugly since MyBB always assumes everything is expanded by default.

My Blog
02-08-2012 10:31 AM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #15
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-08-2012 10:31 AM)ZiNgA BuRgA Wrote:  Possibly.
Cookies are designed to remember things, not set defaults, though you may be able to write some elaborate hack to do some overwriting.
But any solution is going to be ugly since MyBB always assumes everything is expanded by default.

Thank you for the info and insight !
At least have some idea of the degree of difficulty involved.

Even tried eliminating the cookie, but that only got code errors popping up.
And, it would probably effect all other kinds of collapse/expanding in the forum pages.

Seems like it (default category collapse) should be simpler, but guess sometimes 'simple' is more complicated !   Smile

Will keep at it.

Thanks again for your help !
02-08-2012 11:30 AM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #16
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-08-2012 11:30 AM)akm Wrote:  
(02-08-2012 10:31 AM)ZiNgA BuRgA Wrote:  Possibly.
Cookies are designed to remember things, not set defaults, though you may be able to write some elaborate hack to do some overwriting.
But any solution is going to be ugly since MyBB always assumes everything is expanded by default.
Thank you for the info and insight !
At least have some idea of the degree of difficulty involved.
Even tried eliminating the cookie, but that only got code errors popping up.
And, it would probably effect all other kinds of collapse/expanding in the forum pages.
Seems like it (default category collapse) should be simpler, but guess sometimes 'simple' is more complicated !   Smile
Will keep at it.

Found a plug-in(?) called AutoCollapse at...
http://mybbsource.com/mods.php?act=view&id=109#
...but not able to obtain without enough 'MyBux'.
Sounds like might be the answer, but guess will not know until collect enough MyBux.
Ever heard of AC ?

Thanks again for your help !
(This post was last modified: 02-09-2012 12:42 AM by akm.)
02-09-2012 12:41 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #17
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
I remember having a similar question to Pirata Nervo about his shoutbox - I wanted it to be collapsed when I opened the page. I was able to change the templates to do that but it was always collapsed on open,  as if it made the cookies not work.

If that is the sort of behaviour you want I will see if I can find the post where he explained it to me.


[Image: leelink.gif]
MYBB1.6 & XThreads
02-09-2012 08:41 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #18
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-09-2012 12:41 AM)akm Wrote:  Ever heard of AC ?
I personally don't care for non-free plugins.

My Blog
02-09-2012 09:12 AM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #19
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-09-2012 09:12 AM)ZiNgA BuRgA Wrote:  
(02-09-2012 12:41 AM)akm Wrote:  Ever heard of AC ?
I personally don't care for non-free plugins.

Agree.
Although this MyBux thing is kinda interesting, it appears the MyBux are accumulated by using the forum.
Asked one question there a few months back, got a solution, came back yesterday, and saw that got 4 MyBux credited to my 'account' (although the plugin requires 10 MyBux).
So, actually it appears there is not money involved, just participation on the forum ?
Have a message in to the forum admin for clarification.
So, still looking for the collapse.

Thanks again for your help !
02-09-2012 09:28 AM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #20
RE: How to limit # of forums displayed under mainpage categories, pagination, collapse ?
(02-09-2012 08:41 AM)leefish Wrote:  I remember having a similar question to Pirata Nervo about his shoutbox - I wanted it to be collapsed when I opened the page. I was able to change the templates to do that but it was always collapsed on open,  as if it made the cookies not work.
If that is the sort of behaviour you want I will see if I can find the post where he explained it to me.

Thank you for the info !
What you are describing sounds like what may be looking for.
Should only apply to the homepage category display.
And, yes, would like the homepage to open always with categories in a collapsed view... and, if possible, to go back to the collapsed view if the homepage is refreshed.
Would be great if you could find the post, if not too much trouble.

Thanks again for your help !
02-09-2012 12:33 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: