rendered paste body<div class="sideheader"></div>
<div class="sidecontent">
<script src="togglediv.js" type="text/javascript" >
</script>
<?php
function TimeProp ($sec)
{
$ms = "";
$minutes = intval(($sec / 60) % 60);
$ms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
$seconds = intval($sec % 60);
$ms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
return $ms;
}
//will need to make static if database grows
function TotalCat ($cat)
{
$catcount = 0;
global $videos;
foreach($videos as $video)
{
if($video[6] == $cat)
{
$catcount++;
}
}
return $catcount;
}
//style = array('LINK NAME', 'LINK TO')
$quicklinks = array(
array('Home','index.php'),
array('Videos','index.php'),
array('News','index.php'),
array('Random','index.php')
);
//Recent videos are a special case and are NOT included in categories, neither are top videos in reality.
//However I needed a place to categorize videos and it was more convenient than thinking up other fake names
$categories = array(
array('Top','top'),
array('Fiction','fict'),
array('Non-Fiction','nfic'),
array('Peotry','poet')
);
//the "date" is just a simple int because there is no sense in setting this up till I check out mysql
//the "categories" may present an issue as mysql will not likely like 3d depths
//everything is being pointed to index as I have no real videos
//example array('name','lenght in seconds','date','thumbnail','link to video','embeded link',array('categorie1','cat2'))
$videos = array(
array('Fry\'s Dog','194','9','thumb1.png','index.php','','Fiction'),
array('Old School','94','2','thumb2.png','index.php','','Top'),
array('An Oede to Maybe','144','1','thumb1.png','index.php','','Non-Fiction'),
array('Oh My God Ponies','126','3','thumb2.png','index.php','','Fiction'),
array('Soylent Green is People','192','4','thumb1.png','index.php','','Peotry'),
array('My Kind of People','24','9','thumb2.png','index.php','','Non-Fiction'),
array('Royal Jelly','24','9','thumb1.png','index.php','','Peotry'),
array('Slurpies Rule','24','9','thumb2.png','index.php','','Top'),
array('Slurpies Rule2','246','3','thumb1.png','index.php','','Top'),
array('Slurpies Rule3','24','9','thumb2.png','index.php','','Top'),
array('Slurpies Rule4','246','3','thumb1.png','index.php','','Top'),
);
echo "<ul>
<li>
<h2 class=\"center\">Quick Links</h2>
<hr />
<ul>";
foreach($quicklinks as $quicklink)
{
echo "<li><a href=\"{$quicklink[1]}\">{$quicklink[0]}</a></li>";
}
echo "</ul></li>";
echo "</ul>";
echo "<ul>";
$count = 1;
foreach($categories as $categorie)
{
$totalvids=TotalCat($categorie[0]);
$remainvids=$totalvids;
echo "<li>
<div class=\"center\">
<a href=\"javascript:toggleDiv('side{$count}')\">{$categorie[0]}</a>
</div>
<hr />
<div id=\"side{$count}\" class=\"newsitem\">
<br />
<ul class=\"sideprev\">";
$pagecount=0;
$page=1;
foreach($videos as $video)
{
if($video[6] == $categorie[0])
{
//if ($pagecount == 0)
//{
// echo "<div id=\"{$categorie[1]}page{$page}\" ";
// if($page > 1)
// {
// echo "style=\"display:none\"";
// }
// echo ">";
//}
$pagecount++;
echo "<li class=\"{$categorie[1]}page{$page}\"";
if($page > 1)
{
echo " style=\"display:none\"";
}
echo "><a href=\"{$video[4]}\"><img src=\"images/{$video[3]}\" alt=\"{$video[0]}\" class=\"imgprev\" />
<br />{$video[0]} (";
echo TimeProp($video[1]);
echo ")</a></li>";
if($pagecount >= 2 || $pagecount == $remainvids)
{
echo "<li class=\"{$categorie[1]}page{$page}\"";
if($page > 1)
{
echo " style=\"display:none\"";
}
echo ">";
$nextpage = $page + 1;
$prevpage = $page - 1;
if($prevpage > 0)
{
echo "<a href=\"javascript:swapPanes('{$categorie[1]}page{$prevpage}','{$categorie[1]}page{$page}')\" class=\"warning\"><img src=\"images/back.gif\" alt=\"Prev__\" /></a>";
}
if($nextpage <= round($totalvids/2))
{
echo "<a href=\"javascript:swapPanes('{$categorie[1]}page{$nextpage}','{$categorie[1]}page{$page}')\" class=\"warning\"><img src=\"images/forward.gif\" alt=\"__Next\" /></a>";
}
$remainvids-=2;
$pagecount=0;
$page++;
echo "</li>";
}
}
}
echo " </ul>
</div>
</li>";
$count++;
}
echo "</ul>";
?>
</div>
<div class="sidefooter">
</div>