Author |
Message |
Dawg
RavenNuke(tm) Development Team

Joined: Nov 07, 2003
Posts: 928
|
Posted:
Mon Aug 27, 2007 10:16 am |
|
Greetings All,
Because of another project I am working on I recoded the H 3 Block for Video Stream.
This solved several problems with the last block and I also ran it through CSE HTML Validator Lite and it checks out!! WOOT WOOT!!
Save this as block-Video_H3.php and away you go.....
Here is the code....
Code:<?php
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// ------------------------------------------------------------------------- //
//----------------------------------------//
//
//Center Block by Dawg at ravenphpscripts.com//
//Validated with CSE HTML Validator by Dawg//
//Based on The Random video block by Q @ www.3c0x1.net //
//----------------------------------------//
//Center Block to show Latest Video, Highest Rated and Most Viewed//
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $prefix, $prefix, $db;
$limit = 1;
//Views
$result1 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (views) DESC LIMIT $limit");
while ($row1 = $db->sql_fetchrow($result1)) {
$imsrc1 = $row1['imgurl'];
$vid1 = $row1['id'];
if ($row1['vidname'] != '') {
$thumb_title1 = $row1['vidname'];
} else {
$thumb_title1 = substr($row1['imgurl'], 0, -4);
}
// echo "$thumb_title1";
// echo "$imsrc1";
// echo "$vid1";
//Latest Added
$result2 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY id DESC LIMIT $limit");
while ($row2 = $db->sql_fetchrow($result2)) {
$imsrc2 = $row2['imgurl'];
$vid2 = $row2['id'];
if ($row2['vidname'] != '') {
$thumb_title2 = $row2['vidname'];
} else {
$thumb_title2 = substr($row2['imgurl'], 0, -4);
}
// echo "$thumb_title2";
// echo "$imsrc2";
// echo "$vid2";
//Rated
$result3 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (rating/rates) DESC LIMIT $limit");
$result3 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY id DESC LIMIT $limit");
while ($row3 = $db->sql_fetchrow($result3)) {
$imsrc3 = $row3['imgurl'];
$vid3 = $row3['id'];
if ($row3['vidname'] != '') {
$thumb_title3 = $row3['vidname'];
} else {
$thumb_title3 = substr($row3['imgurl'], 0, -4);
}
// echo "$thumb_title3";
// echo "$imsrc3";
// echo "$vid3";
$content .=" <table width=\"100%\">";
$content .=" <tr>";
$content .=" <td><center><b>Most Viewed Video</b></center></td>";
$content .=" <td><center><b>Latest Video</b></center></td>";
$content .=" <td><center><b>Highest Rated Video</b></center></td>";
$content .=" </tr>";
$content .=" <tr>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid1\"><img src=\"$imsrc1\" border=\"0\" width=\"145\" alt=\"$thumb_title1\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid2\"><img src=\"$imsrc2\" border=\"0\" width=\"145\" alt=\"$thumb_title2\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid3\"><img src=\"$imsrc3\" border=\"0\" width=\"145\" alt=\"$thumb_title3\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" </tr>";
$content .=" <tr>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid1\">$thumb_title3</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid2\">$thumb_title3</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid3\">$thumb_title3</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" </tr>";
$content .="</table>";
}
}
}
?>
|
|
|
|
|
 |
mzahdeh
New Member


Joined: Aug 28, 2007
Posts: 6
|
Posted:
Tue Aug 28, 2007 1:46 pm |
|
why does when i activate this block it put the code in the page |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 2:01 pm |
|
Are you saving it as block-Video_H3.php?
What version of Nuke are you using?
Dawg |
|
|
|
 |
mzahdeh

|
Posted:
Tue Aug 28, 2007 2:05 pm |
|
i'm using version 8 and yes i saved it |
|
|
|
 |
mzahdeh

|
Posted:
Tue Aug 28, 2007 2:07 pm |
|
i get this when activating it
ےsql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (views) DESC LIMIT $limit"); while ($row1 = $db->sql_fetchrow($result1)) { $imsrc1 = $row1['imgurl']; $vid1 = $row1['id']; if ($row1['vidname'] != '') { $thumb_title1 = $row1['vidname']; } else { $thumb_title1 = substr($row1['imgurl'], 0, -4); } // echo "$thumb_title1"; // echo "$imsrc1"; // echo "$vid1"; //Latest Added $result2 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY id DESC LIMIT $limit"); while ($row2 = $db->sql_fetchrow($result2)) { $imsrc2 = $row2['imgurl']; $vid2 = $row2['id']; if ($row2['vidname'] != '') { $thumb_title2 = $row2['vidname']; } else { $thumb_title2 = substr($row2['imgurl'], 0, -4); } // echo "$thumb_title2"; // echo "$imsrc2"; // echo "$vid2"; //Rated $result3 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (rating/rates) DESC LIMIT $limit"); $result3 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY id DESC LIMIT $limit"); while ($row3 = $db->sql_fetchrow($result3)) { $imsrc3 = $row3['imgurl']; $vid3 = $row3['id']; if ($row3['vidname'] != '') { $thumb_title3 = $row3['vidname']; } else { $thumb_title3 = substr($row3['imgurl'], 0, -4); } // echo "$thumb_title3"; // echo "$imsrc3"; // echo "$vid3"; $content .=" "; $content .=" "; $content .=" Most Viewed Video "; $content .=" Latest Video "; $content .=" Highest Rated Video "; $content .="
"; $content .=" "; $content .=" "; $content .="
"; $content .=" "; $content .=" "; $content .="
"; $content .=" "; $content .=" "; $content .="
"; $content .=" "; $content .="
"; $content .=" "; $content .=" $thumb_title3"; $content .="
"; $content .=" "; $content .=" $thumb_title3"; $content .="
"; $content .=" "; $content .=" $thumb_title3"; $content .="
"; $content .=" "; $content .="
"; $content .=" "; } } } ?>
Video H3
there is no items for this block |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 2:23 pm |
|
It sounds like a version 8 issue. I have it running on 7.3 and RN NUke (7.6) no problems.
Open up one of you other blocks.....and look at the top of the file
Check this part againest what I have...
Code:<?php
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $prefix, $prefix, $db;
|
|
|
|
|
 |
mzahdeh

|
Posted:
Tue Aug 28, 2007 2:28 pm |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 2:36 pm |
|
You are missing something. Compare the contents of your file to my post above and make sure you named it correctly! block-Video_H_3.php .....I have never even seen 8. I don't know what else it could be.
and just to cover all the bases....you are saving this as a file and uploading it to your server and activating it.....not adding the code to the html block box in blocks admin right? |
|
|
|
 |
p17blo
Regular


Joined: Jul 27, 2007
Posts: 77
|
Posted:
Tue Aug 28, 2007 3:16 pm |
|
Dawg,
Could you tell me what your block does. I know I could download the block, activate it and test it but just wanted to to know from you what it could do.
Paul |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 5:29 pm |
|
Center Block to show Latest Video, Highest Rated and Most Viewed |
|
|
|
 |
p17blo

|
Posted:
Tue Aug 28, 2007 7:41 pm |
|
Sorry I know I am probably jumping into something that is obvious to those in the know, but do you need some kind of module relating to this or does it relate to video elsewhere (ie hosted on another site such at Youtube)?
I do have more than a passing interest as I do have some video on my site which I have struggled with.
Paul |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 7:45 pm |
|
|
|
 |
sweetmail
Hangin' Around

Joined: Aug 23, 2007
Posts: 40
|
Posted:
Tue Aug 28, 2007 8:31 pm |
|
How do you get that Video Stream? Thanks |
|
|
|
 |
Dawg

|
Posted:
Tue Aug 28, 2007 8:51 pm |
|
You download it and install it from the site above.... |
|
|
|
 |
mzahdeh

|
Posted:
Wed Aug 29, 2007 4:00 am |
|
yes i did what you say i saved it then uploaded it to the server and i activated the block and that what happen |
|
|
|
 |
Dawg

|
Posted:
Wed Aug 29, 2007 5:02 am |
|
Do you have video stream installed? |
|
|
|
 |
mzahdeh

|
Posted:
Wed Aug 29, 2007 6:01 am |
|
|
|
 |
Dawg

|
Posted:
Wed Aug 29, 2007 6:50 am |
|
It is an 8 issue is all I can guess. It works on 7.3 and RN7.6....it goes through WC3 testing no problems.
You will have to ask someone that knows somrething about 8.
Dawg |
|
|
|
 |
bozwolf
New Member


Joined: Apr 12, 2007
Posts: 12
|
Posted:
Mon Sep 03, 2007 3:38 pm |
|
my mainpage wont load with the new block, any sugestions? |
|
|
|
 |
Dawg

|
Posted:
Mon Sep 03, 2007 4:09 pm |
|
What version are you using?
Dawg |
|
|
|
 |
Dawg

|
Posted:
Mon Sep 03, 2007 4:30 pm |
|
I found a minor Error in it....here is the new code....
Code:<?php
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// ------------------------------------------------------------------------- //
//----------------------------------------//
//
//Center Block by Dawg at ravenphpscripts.com//
//Validated with CSE HTML Validator by Dawg//
//Based on The Random video block by Q @ www.3c0x1.net //
//----------------------------------------//
//Center Block to show Latest Video, Highest Rated and Most Viewed//
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
global $prefix, $prefix, $db;
$limit = 1;
//Views
$result1 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (views) DESC LIMIT $limit");
while ($row1 = $db->sql_fetchrow($result1)) {
$imsrc1 = $row1['imgurl'];
$vid1 = $row1['id'];
if ($row1['vidname'] != '') {
$thumb_title1 = $row1['vidname'];
} else {
$thumb_title1 = substr($row1['imgurl'], 0, -4);
}
// echo "$thumb_title1";
// echo "$imsrc1";
// echo "$vid1";
//Latest Added
$result2 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY id DESC LIMIT $limit");
while ($row2 = $db->sql_fetchrow($result2)) {
$imsrc2 = $row2['imgurl'];
$vid2 = $row2['id'];
if ($row2['vidname'] != '') {
$thumb_title2 = $row2['vidname'];
} else {
$thumb_title2 = substr($row2['imgurl'], 0, -4);
}
// echo "$thumb_title2";
// echo "$imsrc2";
// echo "$vid2";
//Rated
$result3 = $db->sql_query("SELECT * FROM ".$prefix."_video_stream WHERE request=0 ORDER BY (rating/rates) DESC LIMIT $limit");
while ($row3 = $db->sql_fetchrow($result3)) {
$imsrc3 = $row3['imgurl'];
$vid3 = $row3['id'];
if ($row3['vidname'] != '') {
$thumb_title3 = $row3['vidname'];
} else {
$thumb_title3 = substr($row3['imgurl'], 0, -4);
}
// echo "$thumb_title3";
// echo "$imsrc3";
// echo "$vid3";
$content .=" <table width=\"100%\">";
$content .=" <tr>";
$content .=" <td><center><b>Most Viewed Video</b></center></td>";
$content .=" <td><center><b>Latest Video</b></center></td>";
$content .=" <td><center><b>Highest Rated Video</b></center></td>";
$content .=" </tr>";
$content .=" <tr>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid1\"><img src=\"$imsrc1\" border=\"0\" width=\"145\" alt=\"$thumb_title1\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid2\"><img src=\"$imsrc2\" border=\"0\" width=\"145\" alt=\"$thumb_title2\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid3\"><img src=\"$imsrc3\" border=\"0\" width=\"145\" alt=\"$thumb_title3\" /></a>";
$content .=" </center>";
$content .=" </td>";
$content .=" </tr>";
$content .=" <tr>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid1\">$thumb_title1</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid2\">$thumb_title2</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" <td><center><b><a href=\"modules.php?name=Video_Stream&page=watch&id=$vid3\">$thumb_title3</a></b>";
$content .=" </center>";
$content .=" </td>";
$content .=" </tr>";
$content .="</table>";
}
}
}
?>
|
|
|
|
|
 |
sowsteady
Regular


Joined: Apr 09, 2004
Posts: 87
Location: UK
|
Posted:
Tue Sep 04, 2007 4:24 am |
|
Brilliant Dawg, tried it and it works perfectly. Thanks for sharing this! |
|
|
|
 |
Dawg

|
Posted:
Tue Sep 04, 2007 5:10 am |
|
Well thank goodness.....I was starting to wonder.
I am working on getting it to display mulitbles...you know 2 Latest, 2 most viewed....
Dawg |
|
|
|
 |
sowsteady

|
Posted:
Tue Sep 04, 2007 5:37 am |
|
Dawg wrote: | Well thank goodness.....I was starting to wonder.
I am working on getting it to display mulitbles...you know 2 Latest, 2 most viewed....
Dawg |
Sounds good, might be an idea to display in two rows then.  |
|
|
|
 |
Dawg

|
Posted:
Tue Sep 04, 2007 6:41 am |
|
Ya that is the general Idea. I am going to have to alter the code a bunch to get it to work. It will display it as is.....but becasue it is running in a loop you wind up with like 8 being dispalyed vs 2. I will have to seperate out the loops and cut the code as each one loops through.
So much code so little time....
Dawg |
|
|
|
 |
|