Skip to content

Instantly share code, notes, and snippets.

@fearrr
Last active December 15, 2016 23:34
Show Gist options
  • Save fearrr/34b7bfa6b120c88d23a9fec2d31229fb to your computer and use it in GitHub Desktop.
Save fearrr/34b7bfa6b120c88d23a9fec2d31229fb to your computer and use it in GitHub Desktop.

HTML (forums/front/index/forumRow.phtml)

Цифру 3 в 7 строке можно заменить на нужное число колонок

{{if $forum->hasChildren()}}

      {{$children_count = count($forum->children());}}
      {{$chunk_by = ceil($children_count/3);}}
      {{$chunked = array_chunk($forum->children(), $chunk_by, true);}}

      {{foreach $chunked as $child}}
					<ul class='subforum'>
						{{foreach $child as $subforum}}
							{{if \IPS\forums\Topic::containerUnread($subforum)}}
							<li class='unread'>
								{{endif}}
								{{if !\IPS\forums\Topic::containerUnread($subforum)}}
							<li>
								{{endif}}
								<a href="{$subforum->url()}">
									<i class="fa fa-comment-o"></i> {$subforum->_title}
								</a>
							</li>
						{{endforeach}}
					</ul>
      {{endforeach}}

{{endif}}

CSS (custom.css)

Цифру 3 в 38 строке можно заменить на нужное число колонок

.subforum{
   list-style: none;
   margin: 0;
   padding: 0;
   width: calc(100%/3 - 5%);
   float: left;
   margin-top: 0.5rem;
   margin-right: 3%;
}
.subforum li i{
   color: #B0BEC5;
}

.subforum li.unread i{
   color: #546E7A;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment