Author Topic: Showing 4 most viewed videos  (Read 1702 times)

0 Members and 1 Guest are viewing this topic.

Offline joguins

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Showing 4 most viewed videos
« on: March 14, 2009, 11:31:19 PM »
Hi everybody, im very happy to have you back!!! I missed this forum.

Ill start to "remember" some old codes from this forum.

Insert this code on viewvid.tpl
Quote
{section name=videos_mv loop=$videos_mv max=4}
      <a href="videos.php?id={$videos_mv[videos_mv].id}"><img height='76' width='103' src="{$videos_mv[videos_mv].picture}" class="thumbnail" alt="{$videos_mv[videos_mv].name}" title="{$videos_mv[videos_mv].name}"/>

On this code, i put an ALT, when the user puts the mouse over the image, the name of the videos is showed too.


And insert this code on videos.php after require('header.php');

Quote
$query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY views DESC";
$result_mv = mysql_query($query_mv);
while ($row_mv = mysql_fetch_assoc($result_mv)){
   $videos_mv[] = $row_mv;
}
$smarty->assign('videos_mv', $videos_mv);

THANK YOU GUYS FOR COME BACK..
« Last Edit: March 14, 2009, 11:55:57 PM by joguins »

Offline Jeff

  • Global Moderator
  • Sr phpd Member
  • *****
  • Posts: 359
  • Karma: 5
  • Need help? Feel free to ask.
    • View Profile
Re: Showing 4 most viewed videos
« Reply #1 on: June 17, 2009, 10:30:18 PM »
Thank you for the code

Offline naxtra

  • Full phpd Member
  • ***
  • Posts: 74
  • Karma: 1
    • View Profile
Re: Showing 4 most viewed videos
« Reply #2 on: June 17, 2009, 10:36:04 PM »
Thanks...

Jeff; Congrats for mod  to be soon ;D

Offline xsnoboard

  • phpd Basic Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
    • My Vid Space
Re: Showing 4 most viewed videos
« Reply #3 on: November 09, 2009, 06:40:24 PM »
I am getting errors when I add the code into viewvid.tpl

Offline Jeff

  • Global Moderator
  • Sr phpd Member
  • *****
  • Posts: 359
  • Karma: 5
  • Need help? Feel free to ask.
    • View Profile
Re: Showing 4 most viewed videos
« Reply #4 on: November 10, 2009, 02:58:23 PM »
I am getting errors when I add the code into viewvid.tpl

what error?? Please elaborate

Offline xsnoboard

  • phpd Basic Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
    • My Vid Space
Re: Showing 4 most viewed videos
« Reply #5 on: November 11, 2009, 03:29:52 AM »
Fatal error: Smarty error: [in viewvid.tpl line 151]: syntax error: unclosed tag \{section} (opened line 6). (Smarty_Compiler.class.php, line 317) in /home/cgilman/public_html/myvidspace/libs/Smarty.class.php on line 1095

Offline Jeff

  • Global Moderator
  • Sr phpd Member
  • *****
  • Posts: 359
  • Karma: 5
  • Need help? Feel free to ask.
    • View Profile
Re: Showing 4 most viewed videos
« Reply #6 on: November 11, 2009, 06:29:30 AM »
can you show your entire viewvid.tpl please

Offline xsnoboard

  • phpd Basic Member
  • **
  • Posts: 39
  • Karma: 0
    • View Profile
    • My Vid Space
Re: Showing 4 most viewed videos
« Reply #7 on: November 12, 2009, 01:33:51 AM »
For testing purpose I threw it in at the top. I also tried putting it in the desired location. Same error.


Code: [Select]
{include file="header.tpl"}
<script type="text/javascript" src="turn_off_lights/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="turn_off_lights/turn_off_lights.js"></script>
<div id="shadow"></div>


{section name=videos_mv loop=$videos_mv max=4}
      <a href="videos.php?id={$videos_mv[videos_mv].id}"><img height='76' width='103' src="{$videos_mv[videos_mv].picture}" class="thumbnail" alt="{$videos_mv[videos_mv].name}" title="{$videos_mv[videos_mv].name}"/>


{section name=video loop=$video}
<div id="videowrapper" class="roundedcorner">
<div id="vheader">
<div id="name">
<h2>{$video[video].name}</h2>
</div>
<div id="lights">
<h2><a class="lightSwitcher" href="#">Turn off the lights</a></h2>
</div>
</div>
<div class="clearer"> </div>
<hr />
<br />

<script type="text/javascript"><!--
google_ad_client = "pub-6642898982553977";
/* 468x60, created 10/24/09 */
google_ad_slot = "5755072080";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<div id="video">
{include file="players.tpl"}
<br />


<script type="text/javascript"><!--
google_ad_client = "pub-6642898982553977";
/* 468x15, created 11/3/09 */
google_ad_slot = "3598859789";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

{include file="bookmarks.tpl"}
<br />

   
<?
require('http://firedartonline.com/projects/phpdirector/comments/inc_rate.php');
getComments("{$video[video].id}");
submitComments("{$video[video].id}","$PHP_SELF");
?>
</div>
<div id="info">
<div id="userinfo" class="roundedcorner">

<img class="userlogo" alt="" src="{$video[video].picture}" />


<b>{$LAN_36}:</b> {$video[video].creator}
<br />
<b>{$LAN_32}: </b>{$video[video].views}
<br />
<br />
<br />
<br /><br><br>
<strong>{$LAN_35}:</strong>
<br />
<div id='description'>
{$video[video].description}
</div>
</div>
<div id="rating" class="roundedcorner">
<b>Video Rating:</b>
<br />
{rating_bar units='5' id=$video[video].id}
</div>
<div id="link" class="roundedcorner">
{if $vidtype eq "YouTube"}

<b>Link This Video:</b>
<br />
<a target="_blank" href="http://www.youtube.com/watch?v={if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}">http://www.youtube.com/watch?v={if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}</a>
<br />
<br />
<b>Embed This Video:</b>
<br />
<textarea id="ta1" name="ta1" rows="3" cols="52">
&lt;object type="application/x-shockwave-flash" style="width:450px;
height:366px;" data="http://www.youtube.com/v/{if $video[video].file eq
""}{$videoid}{else}{$video[video].file}{/if}&amp;amp;autoplay=1"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/{if
$video[video].file eq
""}{$videoid}{else}{$video[video].file}{/if}&amp;amp;autoplay=1"
/&gt;
&lt;/object&gt;
</textarea>

{elseif $vidtype eq "GoogleVideo"}
<b>Link This Video:</b>
<br />
<a target="_blank" href="http://video.google.com/videoplay?docid={if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}">http://video.google.com/videoplay?docid={if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}</a>
<br />
<br />
<b>Embed This Video:</b>
<br />
<textarea id="ta1" name="ta1" rows="3" cols="52">
&lt;object type="application/x-shockwave-flash" style="width:425px;
height:344px;" data="http://video.google.com/googleplayer.swf?docId={if
$video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}"
&gt;&nbsp; &lt;param name="movie"
value="http://video.google.com/googleplayer.swf?docId={if
$video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}"
/&gt; &lt;param name="allowFullScreen"
value="true"&gt;&lt;/param&gt; &lt;/object&gt;
</textarea>

{elseif $vidtype eq "dailymotion"}
<b>Link This Video:</b>
<br />
<a target="_blank" href="http://www.dailymotion.com/video/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}">http://www.dailymotion.com/video/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}</a>
<br />
<br />
<b>Embed This Video:</b>
<br />
<textarea id="ta1" name="ta1" rows="3" cols="52">
&lt;object type="application/x-shockwave-flash" width="425"
height="306" data="http://www.dailymotion.com/swf/{if
$video[video].file eq
""}{$videoid}{else}{$video[video].file}{/if}"&gt;&lt;param
name="movie" value="http://www.dailymotion.com/swf/{if
$video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}"
/&gt;&lt;/object&gt;
</textarea>
{/if}
</div>
{/section}
</div>
<div class="clearer"> </div>
</div>
{include file="footer.tpl"}

Offline Jeff

  • Global Moderator
  • Sr phpd Member
  • *****
  • Posts: 359
  • Karma: 5
  • Need help? Feel free to ask.
    • View Profile
Re: Showing 4 most viewed videos
« Reply #8 on: November 12, 2009, 01:51:48 AM »
after
Code: [Select]
<a href="videos.php?id={$videos_mv[videos_mv].id}"><img height='76' width='103' src="{$videos_mv[videos_mv].picture}" class="thumbnail" alt="{$videos_mv[videos_mv].name}" title="{$videos_mv[videos_mv].name}"/>
add

Code: [Select]
{/section}
so it will look like this

Code: [Select]
{section name=videos_mv loop=$videos_mv max=4}
      <a href="videos.php?id={$videos_mv[videos_mv].id}"><img height='76' width='103' src="{$videos_mv[videos_mv].picture}" class="thumbnail" alt="{$videos_mv[videos_mv].name}" title="{$videos_mv[videos_mv].name}"/>
{/section}


let me know if that works...