return related videos according to first category in watch_video.php

This commit is contained in:
fjulio 2010-07-24 14:39:42 +00:00
parent da0ff17a00
commit 88d00427df
3 changed files with 21 additions and 2 deletions

View file

@ -496,7 +496,16 @@ class CBvideo extends CBCategory
$cond .= " ".tbl("video.userid")."='".$params['user']."'";
}
//non-uid to exclude user videos from related
if($params['nonuser'])
{
if($cond!='')
$cond .= ' AND ';
$cond .= " ".tbl("video.userid")." <> '".$params['nonuser']."' ";
}
$tag_n_title='';
//Tags
if($params['tags'])

View file

@ -163,7 +163,7 @@
<!-- Getting Related videos -->
{assign var=videos_items_columns value=func->config(videos_items_columns)}
{get_videos tags=$vdo.tags limit=$videos_items_columns assign=related_vids exclude=$vdo.videoid title=$vdo.title show_related=true}
{get_videos category=$vid_cat nonuser=$vdo.userid exclude=$vdo.videoid limit=$videos_items_columns order="date_added ASC" assign=related_vids}
{if $related_vids}
<span class="watch_vids_head" onclick='$(this).toggleClass("watch_vids_head_closed");$("#related_vids").slideToggle("fast")'>Related Videos</span>
<div class="watch_vids_cont" id="related_vids">

View file

@ -60,6 +60,16 @@ if(video_playable($vkey))
}else
$Cbucket->show_page = false;
//Return category id without '#'
$v_cat = $vdo['category'];
if($v_cat[2] =='#') {
$video_cat = $v_cat[1];
}else{
$video_cat = $v_cat[1].$v_cat[2];}
$vid_cat = str_replace('%#%','',$video_cat);
assign('vid_cat',$vid_cat);
//Displaying The Template
template_files('watch_video.html');
display_it();