Blog Tutorial Addition. Choose between two videoplayer?

Ask about a PHP problem here.
Post Reply
Jaami
Posts: 38
Joined: Wed Nov 23, 2011 11:22 pm
Location: GER

Blog Tutorial Addition. Choose between two videoplayer?

Post 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:
                <!-- 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 -->
Edit: oh, and if you wonder why i need the "flvraw" or "youtube"-text, thats why:
vid_player2.php
<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $post['video']; ?>" frameborder="0" allowfullscreen></iframe>
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Blog Tutorial Addition. Choose between two videoplayer?

Post 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.
Image
Jaami
Posts: 38
Joined: Wed Nov 23, 2011 11:22 pm
Location: GER

Re: Blog Tutorial Addition. Choose between two videoplayer?

Post 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!!.............................. ;)
                    <?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{

                        }
                    }

                    ?>
Last edited by Jaami on Mon Nov 28, 2011 9:15 pm, edited 1 time in total.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Blog Tutorial Addition. Choose between two videoplayer?

Post by jacek »

I didn't even spot the single = ;) But the new code looks good to me :D
Image
Post Reply