Jump to content

How to hide sub-forums from homepage


Gauravk
 Share

Recommended Posts

This is awesome line of code, that did exactly what I want. Thanks a ton. (Btw, it misses a . in beginning).

.ipsDataItem_subList {
 display:none;
}

Actual intent of asking this is to trim down the page size to facilitate the faster load, but just seen that view source still shows all 270+ sub forums and technically there is no benefit in load time, other than the cosmetic gain (which is also great in showing the cleaner look).

Any idea how to kill the codes as well and trim down the page load time and size.....? Thanks.

Link to comment
Share on other sites

Thanks @Gauravk, C&P mistake with the missing dot. 

I'm not sure if a template edit is what you're looking for. However you could remove the following code part in Templates->forums->index->forumRow 

			{{if $forum->hasChildren()}}
				<ul class="ipsDataItem_subList ipsList_inline">
					{{foreach $forum->children() as $subforum}}
						<li class="{{if \IPS\forums\Topic::containerUnread( $subforum )}}ipsDataItem_unread{{endif}}">
							<a href="{$subforum->url()}">{{if \IPS\forums\Topic::containerUnread( $subforum )}}<span class='ipsItemStatus ipsItemStatus_tiny {{if !\IPS\forums\Topic::containerUnread( $subforum ) && !$subforum->redirect_on}}ipsItemStatus_read{{endif}}'><i class="fa fa-circle"></i></span>&nbsp;{{endif}}{$subforum->_title}</a>
						</li>
					{{endforeach}}
				</ul>
			{{endif}}

After that the sub-forums are out of the source. But I don't know if it has any effect in load time etc..

Edited by Storyteller
Link to comment
Share on other sites

Thanks Storyteller, you seems to be awesome with codes. Instead of code editing I was looking more of a push-button option (if any) to disable the sub-forums showing on homepage.

However I tried commenting your codes and it still shows the sub-forum in the source code and same page load size and time. Thanks a lot for your ideas, really helped a lot in getting more cleaner looking homepage.

Link to comment
Share on other sites

@Gauravk Strange, I just tested it again and the sub-forums are out of the source, when I refresh the page after the edit.

Anyway I like the look of the two columns from @Afternowa and I hope some of the Coders will bring out an Addon like the known Sub-forum Managers for vB where you can set the number of columns, for which forum the sub-forums should be displayed or not etc. pp.

Link to comment
Share on other sites

@InsideEdge 

1. Open forumRow.phtml (/html/forums/front/forumRow.phtml)

2. Find (~line 49):

			{{if $forum->hasChildren()}}
				<ul class="ipsDataItem_subList ipsList_inline">
					{{foreach $forum->children() as $subforum}}
						<li class="{{if \IPS\forums\Topic::containerUnread( $subforum )}}ipsDataItem_unread{{endif}}">
							<a href="{$subforum->url()}">{{if \IPS\forums\Topic::containerUnread( $subforum )}}<span class='ipsItemStatus ipsItemStatus_tiny {{if !\IPS\forums\Topic::containerUnread( $subforum ) && !$subforum->redirect_on}}ipsItemStatus_read{{endif}}'><i class="fa fa-circle"></i></span>&nbsp;{{endif}}{$subforum->_title}</a>
						</li>
					{{endforeach}}
				</ul>
			{{endif}}	

and replace with:

			{{if $forum->hasChildren()}}
				<ul class="ipsDataItem_subList ipsList_inline">
					{{foreach $forum->children() as $subforum}}
						<li class="{{if \IPS\forums\Topic::containerUnread( $subforum )}}ipsDataItem_unread{{endif}}">
							<a href="{$subforum->url()}">{{if \IPS\forums\Topic::containerUnread( $subforum )}}<span class='ipsItemStatus ipsItemStatus_tiny unread-star {{if !\IPS\forums\Topic::containerUnread( $subforum ) && !$subforum->redirect_on}}ipsItemStatus_read{{endif}}'><i class="fa fa-star"></i></span>&nbsp;{{else}} <i class="fa fa-star"></i> {{endif}}{$subforum->_title}</a>
						</li>
					{{endforeach}}
				</ul>
			{{endif}}

3. Add the following code to custom.css

/* Remove unread bold */
.ipsApp_front .ipsDataItem_subList .ipsDataItem_unread a { font-weight: normal; }
/* Icon color and size */
.ipsApp_front .ipsDataItem_subList .ipsDataItem_unread .unread-star .fa-star { color: green; font-size: 13px }
/* Remove comma */
.ipsApp_front .ipsDataItem_subList li a:after { content: '' }

 

Link to comment
Share on other sites

  • 2 weeks later...

There is a hook for this but its currently only available on 3.4, and only works for guests. Its excellent, I've used for years without a problems and its by Adriano Faria. Keeps the load down for search engines/guests but lets your members see all the sub-forums.

Hopefully Adriano will update for 4.1 and perhaps also add an option to define which usergroups can / can't see sub-forums.

Might be worth asking him?

Link to comment
Share on other sites

On 3 November 2015 at 09:52:51, steel51 said:

Thank you very much @Afternova, for providing this. What happens  when I install an update of ipb?

After update you need again replace the lines.

I personally use this css trick for two columns:

    .ipsApp_front  .ipsDataItem_subList li {
         width: 200px;
    }

Not the best solution, but it works very well on my board ..  i have set layout row-max-widh in px. 

Video

Link to comment
Share on other sites

On 19. Oktober 2015 um 08:49:35, Storyteller said:

I'm not sure if a template edit is what you're looking for. However you could remove the following code part in Templates->forums->index->forumRow 

After that the sub-forums are out of the source. But I don't know if it has any effect in load time etc..

Many thanks!

Only as a note (because I was searching for myself): For grid view the lines must be deleted in Templates->forums->index->forumGridItem.

Hiding of sub-forums should be an admin option I think.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...