2014-11-15, 10:13 PM
Recently created this code to add onto portal on MyBB. I put this under a template named YouTube
Then added it onto the bottom of portal.php with
I get errors that read:
I don't expect you guys to go through my code, but no matter how I seem to add this I get errors that say unexpected end of file when there is no unexpected end of file -_-
I'm assuming I'm adding it onto the portal the wrong way?
<!-- Ioannis KarAvas ~ karavas.me ~ @karavas -->
<style>
.youtubePreview {
background:url('http://img.youtube.com/vi/aOPGepdbfpo/0.jpg') center no-repeat;
height:200px;
width:480px;
}
.rightcontent
{
margin-bottom: 25px;
float: right;
padding: 0;
color: #FFF;
display: inline-block;
}
.scrollbar
{
overflow-y: scroll;
width: 360px;
height: 100%;
border-bottom: 1px solid black;
}
#videoheader
{
background: black;
padding: 10px;
}
.video
{
color: #B8B8B8;
background-color: #222222; height: 50px; margin-bottom: 5px;
overflow:hidden;
}
.video:hover {
background-color: #525252!important;
}
.video img{
max-height: 50px;
}
#simple::-webkit-scrollbar {
width: 10px;
height: 6px;
}
#simple::-webkit-scrollbar-track {
background: rgba(0,0,0,0.1);
}
#simple::-webkit-scrollbar-thumb{
background: rgba(0,0,0,0.2);
}
#simple::-webkit-scrollbar-thumb:hover{
background: rgba(0,0,0,0.4);
}
#simple::-webkit-scrollbar-thumb:active{
background: rgba(0,0,0,.9);
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<div id="main" style="width: 1000; height: 351px; margin: 0 auto; margin-top: 100px;">
<?php
$youtube = simplexml_load_file('http://gdata.youtube.com/feeds/api/videos?alt=rss&orderby=published&author=1v1lb');
$first = $youtube->channel->item[0];
?>
<!-- Playlist with thumbnails -->
<div class="rightcontent">
<div id="videoheader"><span style="color: #FFFFFF;">Uploads From 1v1LB</span>
</div>
<div class="scrollbar" id="simple">
<ul id="videolist" style="list-style-type: none; padding: 0; margin: 0; background: #1B1B1B;">
<?php
foreach ($youtube->channel->item as $item) { ?>
<li style="cursor:pointer;">
<div class="video" onclick="play(this, '<?php echo basename($item->guid); ?>');" <?php if(($first->guid) == ($item->guid)){ echo "style='background-color: #3A3A3A;'"; } ?>>
<img src="<?php echo $item->children('media', true)->group->children('media',true)->thumbnail->attributes()->url; ?>" style="vertical-align: middle" width="75" height="50">
<?php echo basename($item->title);
?>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<!-- Video Player Box -->
<div id="ytapiplayer" style="width: 620px; height: 480px;" >
You need Flash player 8+ and JavaScript enabled to view this video.
</div>
</div>
<script type="text/javascript">
var params = { allowScriptAccess: "always", allowfullscreen: "true" };
var atts = { id: "myytplayer" };
swfobject.embedSWF("http://www.youtube.com/e/<?php echo basename($first35->guid); ?>?enablejsapi=1&playerapiid=ytplayer?rel=0&autoplay=1&rel=0",
"ytapiplayer", "640", "390", "8", null, null, params, atts);
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
}
function play(el, videoid) {
if (ytplayer) {
ytplayer.loadVideoById(videoid);
}
// reset background-color for all divs which has class video
$('.video').css('background-color', '#222222');
$(el).css('background-color', '#3A3A3A');
}
</script>
Then added it onto the bottom of portal.php with
eval("\$youtube = \"".$templates->get("youtube")."\";");
I get errors that read:
Parse error: syntax error, unexpected end of file in C:\wamp\www\lb\portal.php(631) : eval()'d code(78) : eval()'d code on line 2
Fatal error: Call to a member function children() on a non-object in C:\wamp\www\lb\portal.php(631) : eval()'d code(81) : eval()'d code on line 1
I don't expect you guys to go through my code, but no matter how I seem to add this I get errors that say unexpected end of file when there is no unexpected end of file -_-
I'm assuming I'm adding it onto the portal the wrong way?