[ Video Sharing CMS v4 ] how to display videos randomly?

Started by gee909,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gee909Topic starter

example: if i want the channel "new videos" to change the order of the videos in that channel to display different each time the browser is refreshed. any help is appreciated.
  •  

PHPVibe A.

order by rand()


But it's one of the "do not do" things in seo/coding.

in tpl/main/channel.php

you can change

$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY ".DB_PREFIX."videos.id DESC ".this_offset(bpp());


to
if($channel->cat_id == x) {

$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY rand() ".this_offset(bpp());


} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY ".DB_PREFIX."videos.id DESC ".this_offset(bpp());
}


change the x on

if($channel->cat_id == x) {


to your category id.

gee909Topic starter

Quote from: Alexander on
order by rand()


But it's one of the "do not do" things in seo/coding.

in tpl/main/channel.php

you can change

$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY ".DB_PREFIX."videos.id DESC ".this_offset(bpp());


to
if($channel->cat_id == x) {

$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY rand() ".this_offset(bpp());


} else {
$vq = "select ".$options.", ".DB_PREFIX."users.name as owner FROM ".DB_PREFIX."videos LEFT JOIN ".DB_PREFIX."users ON ".DB_PREFIX."videos.user_id = ".DB_PREFIX."users.id WHERE ".DB_PREFIX."videos.category in (SELECT cat_id from ".DB_PREFIX."channels where cat_id = '".$channel->cat_id."' or child_of = '".$channel->cat_id."' ) and ".DB_PREFIX."videos.pub > 0 ORDER BY ".DB_PREFIX."videos.id DESC ".this_offset(bpp());
}


change the x on

if($channel->cat_id == x) {


to your category id.

Alexander, thanks for the seo warning. So are you saying that it will effect my search engine rankings badly?
  •  

PHPVibe A.

I say to read about and make your own opinion, as I know it is/was like this.

Similar topics (7)