Page 1 of 1

Blog Tutorial Addition. Choose between two videoplayer?

Posted: Mon Nov 28, 2011 3:20 pm
by Jaami
ok, i sucsefully managed to add 1 videoplayer to your "blog tut"-code. ..which i am very proud of myself, after understanding your code and even learned some basics of sql -with my beginner "skills". ;) thank you again!

but now i want to choose between 2 different vid_player1.php(rawflvplayer) and vid_player2.php(youtube-embed-code).

so far so good, look at the attached pic:

0101204521100.jpg


my problem is now with the blog_list.php. i dont know how to make the right if-condtion, so if checked one or the other player and it includes me the vid_player1or2.php.
here is the code of blog_list.php:
[syntax=php] <!-- Video Player HERE -->
<?php

if(empty($post['video'])){



}

else{
if(isset($post['videoplayer'])){
$videoplayer = $post['videoplayer'];

echo "Player selected: ", $videoplayer;
if($videoplayer = 'flvraw'){
include_once(vid_player.php);
}
else{
//include_once(vid_player2.php);
}
}
else{

}
}

?>
<!-- Video Player END -->[/syntax]

Edit: oh, and if you wonder why i need the "flvraw" or "youtube"-text, thats why:
vid_player2.php
[syntax=php]<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $post['video']; ?>" frameborder="0" allowfullscreen></iframe>[/syntax]

Re: Blog Tutorial Addition. Choose between two videoplayer?

Posted: Mon Nov 28, 2011 7:10 pm
by jacek
It looks like you have it pretty much right, what is the problem exactly ?

Also, you really store the video player column as an INT(1) since repeating the same strings over and over will just waste space.

Re: Blog Tutorial Addition. Choose between two videoplayer?

Posted: Mon Nov 28, 2011 8:07 pm
by Jaami
i solved it!! :D

thank you for your tip with the int(1), also it helped to know that i am not completely wrong with my way..
after trying all kinda different stuff yesterday night being all tired..i didnt even look closely, what did i done there, just posting it here. ;)

and all of a sudden i also remembered of some tuts...it must be two "==" in "if($videoplayer == '1')"...duh.


...........coding is great, WHEN IT WORKS!!.............................. ;)
[syntax=php] <?php

if(empty($post['video'])){

}
else{
if(isset($post['videoplayer'])){
$videoplayer = $post['videoplayer'];
echo "Player selected: ", $videoplayer;
if($videoplayer == '1'){
include('vid_player.php');
}
else{
include('vid_player2.php');
}
}
else{

}
}

?>[/syntax]

Re: Blog Tutorial Addition. Choose between two videoplayer?

Posted: Mon Nov 28, 2011 8:20 pm
by jacek
I didn't even spot the single = ;) But the new code looks good to me :D