Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Mon Aug 27, 2007 10:16 am Reply with quote

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 @ [ Only registered users can see links on this board! Get registered or login! ] //
//----------------------------------------//


//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&amp;page=watch&amp;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&amp;page=watch&amp;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&amp;page=watch&amp;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&amp;page=watch&amp;id=$vid1\">$thumb_title3</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="    <td><center><b><a href=\"modules.php?name=Video_Stream&amp;page=watch&amp;id=$vid2\">$thumb_title3</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="    <td><center><b><a href=\"modules.php?name=Video_Stream&amp;page=watch&amp;id=$vid3\">$thumb_title3</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="  </tr>";
$content .="</table>";

                    }
                     }
                      }
   
?>
 
View user's profile Send private message
mzahdeh
New Member
New Member



Joined: Aug 28, 2007
Posts: 6

PostPosted: Tue Aug 28, 2007 1:46 pm Reply with quote

why does when i activate this block it put the code in the page
 
View user's profile Send private message
Dawg







PostPosted: Tue Aug 28, 2007 2:01 pm Reply with quote

Are you saving it as block-Video_H3.php?

What version of Nuke are you using?

Dawg
 
mzahdeh







PostPosted: Tue Aug 28, 2007 2:05 pm Reply with quote

i'm using version 8 and yes i saved it
 
mzahdeh







PostPosted: Tue Aug 28, 2007 2:07 pm Reply with quote

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







PostPosted: Tue Aug 28, 2007 2:23 pm Reply with quote

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







PostPosted: Tue Aug 28, 2007 2:28 pm Reply with quote

it's the same
 
Dawg







PostPosted: Tue Aug 28, 2007 2:36 pm Reply with quote

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
Regular



Joined: Jul 27, 2007
Posts: 77

PostPosted: Tue Aug 28, 2007 3:16 pm Reply with quote

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
 
View user's profile Send private message
Dawg







PostPosted: Tue Aug 28, 2007 5:29 pm Reply with quote

Center Block to show Latest Video, Highest Rated and Most Viewed
 
p17blo







PostPosted: Tue Aug 28, 2007 7:41 pm Reply with quote

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







PostPosted: Tue Aug 28, 2007 7:45 pm Reply with quote

LOL....Yes...Sorry for that....
[ Only registered users can see links on this board! Get registered or login! ]

You will need Video Stream from there...

It's all good.
 
sweetmail
Hangin' Around



Joined: Aug 23, 2007
Posts: 40

PostPosted: Tue Aug 28, 2007 8:31 pm Reply with quote

How do you get that Video Stream? Thanks
 
View user's profile Send private message
Dawg







PostPosted: Tue Aug 28, 2007 8:51 pm Reply with quote

You download it and install it from the site above....
 
mzahdeh







PostPosted: Wed Aug 29, 2007 4:00 am Reply with quote

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







PostPosted: Wed Aug 29, 2007 5:02 am Reply with quote

Do you have video stream installed?
 
mzahdeh







PostPosted: Wed Aug 29, 2007 6:01 am Reply with quote

yes
 
Dawg







PostPosted: Wed Aug 29, 2007 6:50 am Reply with quote

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
New Member



Joined: Apr 12, 2007
Posts: 12

PostPosted: Mon Sep 03, 2007 3:38 pm Reply with quote

my mainpage wont load with the new block, any sugestions?
 
View user's profile Send private message
Dawg







PostPosted: Mon Sep 03, 2007 4:09 pm Reply with quote

What version are you using?

Dawg
 
Dawg







PostPosted: Mon Sep 03, 2007 4:30 pm Reply with quote

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 @ [ Only registered users can see links on this board! Get registered or login! ] //
//----------------------------------------//


//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&amp;page=watch&amp;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&amp;page=watch&amp;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&amp;page=watch&amp;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&amp;page=watch&amp;id=$vid1\">$thumb_title1</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="    <td><center><b><a href=\"modules.php?name=Video_Stream&amp;page=watch&amp;id=$vid2\">$thumb_title2</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="    <td><center><b><a href=\"modules.php?name=Video_Stream&amp;page=watch&amp;id=$vid3\">$thumb_title3</a></b>";
$content .="    </center>";
$content .="    </td>";
$content .="  </tr>";
$content .="</table>";

                    }
                     }
                      }
   
?>
 
sowsteady
Regular
Regular



Joined: Apr 09, 2004
Posts: 87
Location: UK

PostPosted: Tue Sep 04, 2007 4:24 am Reply with quote

Brilliant Dawg, tried it and it works perfectly. Thanks for sharing this!
 
View user's profile Send private message Visit poster's website
Dawg







PostPosted: Tue Sep 04, 2007 5:10 am Reply with quote

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







PostPosted: Tue Sep 04, 2007 5:37 am Reply with quote

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. Smile
 
Dawg







PostPosted: Tue Sep 04, 2007 6:41 am Reply with quote

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
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©