• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] hide sub channel/category

Started by neospider69,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neospider69Topic starter

how to hide sub categories/channels from the listing.

i know i have to edit functions.php

function the_nav($type=1) {
global $db, $cachedb;
include_once( INC.'/class.tree.php' );
$nav = '';
$tree = new Tree;
$categories = $cachedb->get_results("SELECT cat_id as id,cat_desc, child_of as ch, cat_name as name, picture FROM  ".DB_PREFIX."channels WHERE type='$type' order by cat_name ASC limit 0,10000");
if($categories) {
foreach ($categories as $cat) {
if($cat->ch < 1) {$cat->ch = null;}
$label = '
<div class="cHolder">
<div class="cThumb"><a href="'.channel_url($cat->id, $cat->name).'" title="'. _html($cat->name).'"><img src="'.thumb_fix($cat->picture, true, 115, 86).'" class="cImg"/></a></div>
<div class="cCon">
<div class="cTitle">
<a href="'.channel_url($cat->id, $cat->name).'" title="'. _html($cat->name).'">'. _html($cat->name).'</a>
</div>
<div class="cDesc">'. _html($cat->cat_desc).'</div>
</div>
</div>
';
$li_attr = '';
$tree->add_row($cat->id, $cat->ch, $li_attr, $label);
}
$nav .=$tree->generate_list();


i just can't figure what to edit in order to hide them.

Any help?
  •  

neospider69Topic starter

i tried with this, but still shows sub channels as main channels?

if($cat->child_of !=0) {echo null;}
elseif
($cat->child_of ==0) {$cat->ch = null;}
$label = '
  •  

Marius P.

Try this:

Instead of

$tree->add_row($cat->id, $cat->ch, $li_attr, $label);



do


if(intval($cat->ch) < 1) {
$tree->add_row($cat->id, $cat->ch, $li_attr, $label);
}
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

Marius P.

Or even better, don't query them unless they are main lvl

$categories = $cachedb->get_results("SELECT cat_id as id,cat_desc, child_of as ch, cat_name as name, picture FROM  ".DB_PREFIX."channels WHERE type='$type' order by cat_name ASC limit 0,10000");



edit to




$categories = $cachedb->get_results("SELECT cat_id as id,cat_desc, child_of as ch, cat_name as name, picture FROM  ".DB_PREFIX."channels WHERE (type='$type' and child_of < 1)  order by cat_name ASC limit 0,10000");
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  

neospider69Topic starter

  •  

Similar topics (7)