Hi Andy,
Thanking you for making me feel welcome 
Yeh, I can change the template, but it is undefined. I am very, very (a couple of days old) in Codoforum and I am just trying to find my way around.
I have found the controllers and the js files (php I am ok, javascript not so but I can follow it).
I am doing something wrong - clearly - but I feel like I am missing something. I also am not sure if I am supposed to be finding a "cleaner" way to create a block or something rather than directly edit files.
I will keep trying and hope that admin / Adesh are kind enough to assist.
Thanks again,
UPDATE:
controller/forum.php - found it !
Again, thank you Andy for the moral support
I don't know if this helps, but in case anyone else is looking to do something like this - all corrections welcome - here is what I did.
sys/Controller/Ajax/forum/forum.php
after
$this->assign_admin_vars($tuid);
add
$new_topics = array();
if (\CODOF\User\CurrentUser\CurrentUser::loggedIn()) {
$tracker = new \CODOF\Forum\Tracker($this->db);
$new_topics = $tracker->get_new_topic_counts();
}
$this->smarty->assign('new_topics', $new_topics);
if (Util::get_opt('forum_type') === 'classic') {
$raw_cats = $cat->getCategoriesForClassicView($new_topics);
$cats = $cat->generateNestedCategories($raw_cats);
} else {
$raw_cats = $cat->get_categories();
$api = new Ajax\forum\topics();
$num_topics_page = \CODOF\Util::get_opt('num_posts_all_topics');
$data = $api->get_topics($num_topics_page * ($page - 1), Topic::$FETCH_TYPE_LATEST, !empty($search_data));
$total_topics = $topic->get_total_num_topics();
$this->smarty->assign('load_more_hidden', false);
if ($total_topics < $num_topics_page) {
$this->smarty->assign('load_more_hidden', true);
}
$total_pages = $topic->get_num_pages($total_topics, $num_topics_page);
$this->smarty->assign('topics', \CODOF\HB\Render::tpl('forum/topics', $data));
$this->smarty->assign('total_num_topics', $total_topics);
$this->smarty->assign('pagination', $topic->paginate($total_pages, $page, 'topics/', false, $search_data));
$this->smarty->assign('num_posts_per_page', $num_topics_page);
$this->smarty->assign('curr_page', $page);
$this->smarty->assign('total_pages', $total_pages);
$cats = $cat->generate_tree($raw_cats);
}
$this->smarty->assign('cats', $cats);
$this->smarty->assign('subcategory_dropdown', \CODOF\Util::get_opt('subcategory_dropdown'));
$user = \CODOF\User\User::get();
sites/assets/js/topic/topic.js
before
CODOF.search_data = JSON.parse(CODOFVAR.search_data);
Add
$('.codo_category_toggle').parent().parent().find('ul:first').hide();
$('.codo_category_toggle').on('click', function () {
$(this).parent().parent().find('ul:first').slideToggle();
});
CODOF.toggleTopicsAndCategories = function () {
$('.codo_categories').toggle();
};
$('#codo_categories_ul').mouseenter(function () {
CODOF.inside_categories_container = true;
}).mouseleave(function () {
CODOF.inside_categories_container = false;
});
$('.codo_categories_category').on('click', function () {
var href = $(this).find('a').attr('href');
if (href)
window.location.href = $(this).find('a').attr('href');
});
$('#codo_category_all_topics').on('click', function () {
$('#codo_categories_ul').slideToggle(200);
$(this).find('i').toggleClass('icon-arrow-up icon-arrow-down')
});
CODOF.hook.add('before_req_fetch_topics', function () {
CODOF.req.url = 'Ajax/topics/get_topics';
$.extend(CODOF.req.data, CODOF.search_data);
});
$('#codo_category_select li').on('click', function () {
window.location = codo_defs.url + "category/" + $(this).data('alias');
});
topic.less
.codo_category_toggle {
min-height: 50px;
background: @categoryListHoverBg;
padding: 14px 9px;
margin-left: 12px;
cursor: pointer;
&:hover {
background: @categoryListBg;
}
}
#codo_category_all_topics {
border-bottom: 1px solid #eee;
margin-right: 155px;
margin-left: 75px;
margin-top: 22px;
}
.codo_categories {
font-family: @descFontFamily;
position: relative;
background: transparent;
.dropdown-menu {
border-radius: 0;
width: 100%;
padding: 5px 0;
margin: 0;
border-top: 0;
a {
text-shadow: none;
}
}
}
ul {
padding: 0;
list-style-type: none;
margin: 0;
border-top: 0
}
#codo_categories_ul {
background: @bg;
margin-left: 75px;
width: 73%;
.codo_categories_category.col-md-11.col-11 {
padding-left: 60px;
}
.codo_last_level_li .row {
border-bottom: 0 !important;
}
li {
position: relative;
.codo_category_title_topics {
padding: 20px 10px 10px 36px;
font-weight: bold;
}
}
li {
padding: 10px 0;
}
ul {
margin-left: 1em;
position: relative;
border: 0;
ul {
margin-left: 14px;
}
&:before {
content: "";
display: block;
width: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
}
li {
&:before {
content: "";
display: block;
width: 10px;
height: 0;
margin-top: -1px;
position: absolute;
top: 22px;
left: 0;
}
&:last-child:before {
background: @bg;
height: auto;
top: 22px;
bottom: 0;
}
}
}
}
.codo_new_topics_count {
float: right;
margin-top: 10px;
position: relative;
margin-right: 8px;
min-width: 19px;
text-align: center;
color: @categoryListNewTopicsColor;
padding: 3px;
background: @categoryListNewTopicsBg;
box-shadow: @categoryListNewTopicsBoxShadow;
border-radius: 10px;
line-height: 12px;
display: none;
}
.codo_category_img {
padding: 0;
text-align: center;
cursor: pointer;
max-width: 50px;
display: none;
img {
width: 100%;
}
}
.codo_categories_category {
cursor: pointer;
position: relative;
a {
color: @categoryList_A_Color;
text-decoration: none;
font-size: 13px;
font-weight: bold;
.transition(0.5s all ease-in-out);
&:hover {
color: @categoryList_A_HoverColor;
text-decoration: none;
}
}
> div {
width: 80%;
display: inline-block;
margin-left: 8px;
}
.codo_category_title_header {
}
.codo_category_title {
margin-top: 5px;
display: inline-block;
font-family: @titleFontFamily;
float: left;
cursor: pointer;
}
.codo_category_title_active {
border-left: 5px solid @startGradient;
line-height: 16px;
}
i {
float: right;
margin-right: 8px;
}
.codo_category_num_topics {
font-family: @numericFontFamily;
font-size: 10px;
float: right;
margin-top: 0px;
position: relative;
margin-right: 4px;
background-color: #cccccc;
width: 32px;
text-align: center;
border-radius: 3px;
}
}
> a {
text-decoration: none;
&:hover {
text-decoration: none;
}
}
.active {
background: @categoryListActiveBg;
color: @categoryListActiveColor;
text-shadow: @categoryListActiveTextShadow;
border: 1px solid @borderColor;
border-bottom: 0;
i {
color: @categoryListActiveColor;
}
.codo_category_title {
margin: 0;
width: 40%;
}
.codo_category_num_topics {
margin: 0
}
.codo_mark_all_read {
width: initial;
padding: 5px 6px;
float: right;
position: absolute;
right: 49px;
top: 1px;
}
&:hover {
background: @categoryListActiveHoverBg;
color: @categoryListActiveHoverColor;
}
> .codo_category_content {
color: @categoryListActiveContentColor;
}
}
@media only screen and (min-width: @screen-md-min) {
.codo_categories {
padding-left: 8px;
padding-right: 0;
}
}
@media (max-width: 991px) {
}
@media only screen and (max-width: 480px) {
}
@media (max-width: 767px) {
#codo_categories_ul .codo_categories_category.col-md-11.col-11 {
padding-left: 20px;
}
#codo_category_all_topics {
margin-right: 53px;
}
.codo_categories_category.col-xs-11 {
width: 85%;
}
}
@media (max-width: @screen-fw-max) {
}
Add wanted to put it under breadcrumbs and have it closed on entry.
themes/default/template/forum/topic.tpl
<div class="codo_categories" id="codo_categories_sidebar">
<div class="row codo_categories_line" id="codo_category_all_topics" style="border-bottom:1px solid #eee; left: 0;right:0;">
<div class="codo_categories_category col-xs-11">
<div class="codo_category_title_header">{_t("Categories")}</div>
</div>
<div class="codo_categories_category col-xs-1">
<div class="codo_category_title_header"><i class="icon-arrow-down"></i></div>
</div>
</div>
<ul id="codo_categories_ul" style="display:none;">
<li>
<div class="row">
<div class="codo_categories_category col-md-11 col-11">
<a href="#">
<div style="padding-left: 25px"
class="codo_category_title codo_category_title_active">{_t("All topics")}</div>
</a>
<span data-toggle="tooltip" data-placement="bottom" title="{_t('No. of topics')}"
class="codo_category_num_topics codo_bs_tooltip">
{$total_num_topics}
</span>
</div>
</div>
</li>
{foreach from=$cats item=cat}
<li>
<div class="row">
<div class="codo_categories_category col-md-11 col-11">
<a href="{$smarty.const.RURI}category/{$cat->cat_alias|escape:url}">
<div class="codo_category_title">{$cat->cat_name}</div>
</a>
<span data-toggle="tooltip" data-placement="bottom"
title="{_t('No. of topics')}"
class="codo_category_num_topics codo_bs_tooltip">
{if $cat->granted eq 1}
{$cat->no_topics|abbrev_no}
{else} -
{/if}
</span>
{*
{if isset($new_topics) && isset($new_topics[$cat->cat_id])}
<a title="{_t('new topics')}"><span class="codo_new_topics_count">{$new_topics[$cat->cat_id]|abbrev_no}</span></a>
{/if}
*}
</div>
{if $cat->show_children eq 0}
<div class="codo_category_toggle col-md-1 col-1"><i
class="icon-arrow-down"></i></div>
{/if}
</div>
{get_children cat=$cat new_topics=$new_topics}
</li>
{/foreach}
</ul>
</div>
I am sure it is not ideal to edit files, but it was a good way ( for me at least ) to learn the structure.
This is my result.

Hi Andy,
Thanking you for making me feel welcome :)
Yeh, I can change the template, but it is undefined. I am very, very (a couple of days old) in Codoforum and I am just trying to find my way around.
I have found the controllers and the js files (php I am ok, javascript not so but I can follow it).
I am doing something wrong - clearly - but I feel like I am missing something. I also am not sure if I am supposed to be finding a "cleaner" way to create a block or something rather than directly edit files.
I will keep trying and hope that admin / Adesh are kind enough to assist.
Thanks again,
UPDATE:
controller/forum.php - found it !
Again, thank you Andy for the moral support 8)
I don't know if this helps, but in case anyone else is looking to do something like this - all corrections welcome - here is what I did.
sys/Controller/Ajax/forum/forum.php
after
````
$this->assign_admin_vars($tuid);
````
add
````
//START ADD CATEGORIES
//get complete list of topics
$new_topics = array();
if (\CODOF\User\CurrentUser\CurrentUser::loggedIn()) {
$tracker = new \CODOF\Forum\Tracker($this->db);
$new_topics = $tracker->get_new_topic_counts();
}
$this->smarty->assign('new_topics', $new_topics);
//$cat->update_count($cats);
if (Util::get_opt('forum_type') === 'classic') {
$raw_cats = $cat->getCategoriesForClassicView($new_topics);
$cats = $cat->generateNestedCategories($raw_cats);
} else {
//gets category name and no of topics each hold
$raw_cats = $cat->get_categories();
$api = new Ajax\forum\topics();
$num_topics_page = \CODOF\Util::get_opt('num_posts_all_topics');
$data = $api->get_topics($num_topics_page * ($page - 1), Topic::$FETCH_TYPE_LATEST, !empty($search_data));
$total_topics = $topic->get_total_num_topics();
$this->smarty->assign('load_more_hidden', false);
if ($total_topics < $num_topics_page) {
$this->smarty->assign('load_more_hidden', true);
}
$total_pages = $topic->get_num_pages($total_topics, $num_topics_page);
$this->smarty->assign('topics', \CODOF\HB\Render::tpl('forum/topics', $data));
$this->smarty->assign('total_num_topics', $total_topics);
$this->smarty->assign('pagination', $topic->paginate($total_pages, $page, 'topics/', false, $search_data));
$this->smarty->assign('num_posts_per_page', $num_topics_page);
$this->smarty->assign('curr_page', $page);
$this->smarty->assign('total_pages', $total_pages);
$cats = $cat->generate_tree($raw_cats);
}
$this->smarty->assign('cats', $cats);
$this->smarty->assign('subcategory_dropdown', \CODOF\Util::get_opt('subcategory_dropdown'));
$user = \CODOF\User\User::get();
//$this->smarty->assign('can_search', $user->can('use search'));
//END ADD CATEGORIES
````
sites/assets/js/topic/topic.js
before
````
CODOF.search_data = JSON.parse(CODOFVAR.search_data);
````
Add
````
//START ADD CATEGORIES
//hide all sub categories of parent categories with show_children 0
$('.codo_category_toggle').parent().parent().find('ul:first').hide();
$('.codo_category_toggle').on('click', function () {
$(this).parent().parent().find('ul:first').slideToggle();
});
CODOF.toggleTopicsAndCategories = function () {
$('.codo_categories').toggle();
};
$('#codo_categories_ul').mouseenter(function () {
CODOF.inside_categories_container = true;
}).mouseleave(function () {
CODOF.inside_categories_container = false;
});
$('.codo_categories_category').on('click', function () {
var href = $(this).find('a').attr('href');
if (href)
window.location.href = $(this).find('a').attr('href');
});
$('#codo_category_all_topics').on('click', function () {
$('#codo_categories_ul').slideToggle(200);
$(this).find('i').toggleClass('icon-arrow-up icon-arrow-down')
//$(this).find('i').toggleClass('fa-caret-up fa-caret-down')
});
CODOF.hook.add('before_req_fetch_topics', function () {
CODOF.req.url = 'Ajax/topics/get_topics';
$.extend(CODOF.req.data, CODOF.search_data);
});
$('#codo_category_select li').on('click', function () {
window.location = codo_defs.url + "category/" + $(this).data('alias');
});
//END ADD CATEGORY
````
topic.less
````
.codo_category_toggle {
min-height: 50px;
background: @categoryListHoverBg;
padding: 14px 9px;
margin-left: 12px;
cursor: pointer;
&:hover {
background: @categoryListBg;
}
}
#codo_category_all_topics {
border-bottom: 1px solid #eee;
margin-right: 155px;
margin-left: 75px;
margin-top: 22px;
}
.codo_categories {
//margin-top: 6px;
font-family: @descFontFamily;
position: relative;
//overflow: auto;
background: transparent;
.dropdown-menu {
border-radius: 0;
width: 100%;
padding: 5px 0;
margin: 0;
border-top: 0;
a {
text-shadow: none;
}
}
}
ul {
padding: 0;
list-style-type: none;
margin: 0;
//border: 1px solid @categoryListContainerBorderColor;
//border-bottom: 0;
border-top: 0
}
#codo_categories_ul {
background: @bg;
//padding: 20px 0;
margin-left: 75px;
width: 73%;
.codo_categories_category.col-md-11.col-11 {
padding-left: 60px;
}
.codo_last_level_li .row {
border-bottom: 0 !important;
}
li {
//padding-left: 8px;
position: relative;
.codo_category_title_topics {
padding: 20px 10px 10px 36px;
font-weight: bold;
}
}
li {
//border-top: 1px solid @borderColor;
padding: 10px 0;
}
ul {
margin-left: 1em; /* indentation */
position: relative;
border: 0;
ul {
margin-left: 14px;
}
&:before {
content: "";
display: block;
width: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
//border-left:1px dotted;
}
li {
&:before {
content: "";
display: block;
width: 10px; /* same with indentation */
height: 0;
//border-top:1px dotted;
margin-top: -1px; /* border top width */
position: absolute;
top: 22px; /* (line-height/2) */
left: 0;
}
&:last-child:before {
background: @bg; /* same with body background */
height: auto;
top: 22px; /* (line-height/2) */
bottom: 0;
}
}
}
}
.codo_new_topics_count {
float: right;
margin-top: 10px;
position: relative;
margin-right: 8px;
min-width: 19px;
text-align: center;
color: @categoryListNewTopicsColor;
padding: 3px;
background: @categoryListNewTopicsBg;
box-shadow: @categoryListNewTopicsBoxShadow;
border-radius: 10px;
line-height: 12px;
display: none;
}
.codo_category_img {
padding: 0;
text-align: center;
//min-height: 50px;
cursor: pointer;
max-width: 50px;
display: none;
img {
width: 100%;
//width: 36px;
//height: 36px;
//margin-top: 6px;
}
}
.codo_categories_category {
// text-shadow: @categoryListTextShadow;
cursor: pointer;
position: relative;
//padding: 0px;
//padding-right: 10px;
//force width for sub topics
//width: 92%;
a {
color: @categoryList_A_Color;
text-decoration: none;
font-size: 13px;
font-weight: bold;
.transition(0.5s all ease-in-out);
&:hover {
color: @categoryList_A_HoverColor;
text-decoration: none;
}
}
> div {
width: 80%;
display: inline-block;
margin-left: 8px;
}
.codo_category_title_header {
//padding: 20px;
//padding-left: 30px;
}
.codo_category_title {
//font-weight: bold;
//font-size: 13px;
margin-top: 5px;
//margin-left: 10px;
//padding-left: 30px;
display: inline-block;
font-family: @titleFontFamily;
float: left;
//width: 86%;
cursor: pointer;
}
.codo_category_title_active {
border-left: 5px solid @startGradient;
line-height: 16px;
}
i {
float: right;
margin-right: 8px;
}
.codo_category_num_topics {
font-family: @numericFontFamily;
font-size: 10px;
float: right;
margin-top: 0px;
position: relative;
margin-right: 4px;
background-color: #cccccc;
width: 32px;
//padding: 6px 0;
text-align: center;
border-radius: 3px;
}
}
> a {
text-decoration: none;
&:hover {
text-decoration: none;
}
}
.active {
background: @categoryListActiveBg;
color: @categoryListActiveColor;
text-shadow: @categoryListActiveTextShadow;
border: 1px solid @borderColor;
border-bottom: 0;
i {
color: @categoryListActiveColor;
}
.codo_category_title {
margin: 0;
width: 40%;
}
.codo_category_num_topics {
margin: 0
}
.codo_mark_all_read {
width: initial;
padding: 5px 6px;
float: right;
position: absolute;
right: 49px;
top: 1px;
}
&:hover {
background: @categoryListActiveHoverBg;
color: @categoryListActiveHoverColor;
}
> .codo_category_content {
color: @categoryListActiveContentColor;
}
}
/* Medium devices (desktops, 992px and up) */
@media only screen and (min-width: @screen-md-min) {
.codo_categories {
padding-left: 8px;
padding-right: 0;
}
}
@media (max-width: 991px) {
}
@media only screen and (max-width: 480px) {
}
@media (max-width: 767px) {
#codo_categories_ul .codo_categories_category.col-md-11.col-11 {
padding-left: 20px;
}
#codo_category_all_topics {
margin-right: 53px;
}
.codo_categories_category.col-xs-11 {
width: 85%;
}
}
/* Screens less than 533px considered mobiles
Make them full width for optimum readability */
@media (max-width: @screen-fw-max) {
}
````
Add wanted to put it under breadcrumbs and have it closed on entry.
themes/default/template/forum/topic.tpl
````
<!-- START ADD CATEGORIES -->
<div class="codo_categories" id="codo_categories_sidebar">
<div class="row codo_categories_line" id="codo_category_all_topics" style="border-bottom:1px solid #eee; left: 0;right:0;">
<div class="codo_categories_category col-xs-11">
<div class="codo_category_title_header">{_t("Categories")}</div>
</div>
<div class="codo_categories_category col-xs-1">
<div class="codo_category_title_header"><i class="icon-arrow-down"></i></div>
</div>
</div>
<ul id="codo_categories_ul" style="display:none;">
<li>
<div class="row">
<div class="codo_categories_category col-md-11 col-11">
<a href="#">
<div style="padding-left: 25px"
class="codo_category_title codo_category_title_active">{_t("All topics")}</div>
</a>
<span data-toggle="tooltip" data-placement="bottom" title="{_t('No. of topics')}"
class="codo_category_num_topics codo_bs_tooltip">
{$total_num_topics}
</span>
</div>
</div>
</li>
{foreach from=$cats item=cat}
<li>
<div class="row">
<div class="codo_categories_category col-md-11 col-11">
<a href="{$smarty.const.RURI}category/{$cat->cat_alias|escape:url}">
<div class="codo_category_title">{$cat->cat_name}</div>
</a>
<span data-toggle="tooltip" data-placement="bottom"
title="{_t('No. of topics')}"
class="codo_category_num_topics codo_bs_tooltip">
{if $cat->granted eq 1}
{$cat->no_topics|abbrev_no}
{else} -
{/if}
</span>
{*
{if isset($new_topics) && isset($new_topics[$cat->cat_id])}
<a title="{_t('new topics')}"><span class="codo_new_topics_count">{$new_topics[$cat->cat_id]|abbrev_no}</span></a>
{/if}
*}
</div>
{if $cat->show_children eq 0}
<div class="codo_category_toggle col-md-1 col-1"><i
class="icon-arrow-down"></i></div>
{/if}
</div>
{get_children cat=$cat new_topics=$new_topics}
</li>
{/foreach}
</ul>
</div>
<!-- END ADD CATEGORIES -->
````
I am sure it is not ideal to edit files, but it was a good way ( for me at least ) to learn the structure.
This is my result.

