Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #121 (permalink)  
Old 08-27-2007, 05:59 PM
Casual Pligger
 
Join Date: Mar 2007
Posts: 54
Thanks: 11
Thanked 5 Times in 3 Posts
Smile Sharing codes for play.php in video display mod

Hi everybody !

These are the codes I put in my play.php file used to implement the video display function with pligg. Aside from the youtube and google video links, I added also the possibility to add videos from myspace and zappinternet (spanish). I still have a problem to find the right coding to Dailymotion - Share Your Videos, the way the link their url to their swf player is a bit different, so if somebody has got dailymotion working in its videodisplay function, tell us what the right code is.

SO here's my code in play.php... all of them are working ! But I cannot fix dailymotion... please, if somebody knows..
--------------------------

Code:
function embed_video($url){
    if (preg_match("/http:\/\/video.google.com\/videoplay\?docid=([0-9\-]*)(.*)/i", $url, $matches)) {
        return '<object width="400" height="326">'.
			   '<embed src="http://video.google.com/googleplayer.swf?docId='.$matches[1].'" type="application/x-shockwave-flash" width="400" height="326" />'.
			   '</object>';
    }

	if (preg_match("/http:\/\/video.google.es\/videoplay\?docid=([0-9\-]*)(.*)/i", $url, $matches)) {
        return '<object width="400" height="326">'.
			   '<embed src="http://video.google.es/googleplayer.swf?docId='.$matches[1].'" type="application/x-shockwave-flash" width="400" height="326" />'.
			   '</object>';
    }
    if (preg_match("/http:\/\/www.youtube.com\/watch\?v=([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="425" height="350">'.
               '<param name="movie" value="http://www.youtube.com/v/'.$matches[1].'" />'.
               '<param name="wmode" value="transparent" />'.
               '<embed src="http://www.youtube.com/v/'.$matches[1].'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350" />'.
               '</object>';
    }
 if (preg_match("/http:\/\/www.youtube.es\/watch\?v=([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="425" height="350">'.
               '<param name="movie" value="http://www.youtube.es/v/'.$matches[1].'" />'.
               '<param name="wmode" value="transparent" />'.
               '<embed src="http://www.youtube.es/v/'.$matches[1].'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350" />'.
               '</object>';
    }
 if (preg_match("/http:\/\/es.youtube.com\/watch\?v=([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="425" height="350">'.
               '<param name="movie" value="http://es.youtube.com/v/'.$matches[1].'" />'.
               '<param name="wmode" value="transparent" />'.
               '<embed src="http://www.youtube.com/v/'.$matches[1].'&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350" />'.
               '</object>';
    }
	if (preg_match("/http:\/\/vids.myspace.com\/index.cfm\?fuseaction=vids.individual&videoid=([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="430" height="346">'.
			   '<embed src="http://lads.myspace.com/videos/vplayer.swf?m='.$matches[1].'" type="application/x-shockwave-flash" width="430" height="346">'.
			   '</object>';
	}
	if (preg_match("/http:\/\/www.zappinternet.com\/video\/([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="430" height="345">'.
			   '<embed style="width:430px; height:345px;" id="VideoZappInternet" type="application/x-shockwave-flash" src="http://zappinternet.com/flash/zappplayer.swf?embed=true&idvideo='.$matches[1].'">'.
			   '</object>';
    }
	
    return '';
}
----------------------------
Reply With Quote
  #122 (permalink)  
Old 08-28-2007, 12:12 PM
crakez's Avatar
Designer
Pligg Version: 9.8.2
Pligg Template: Fresh Template
 
Join Date: Jul 2007
Location: Australia
Posts: 142
Thanks: 14
Thanked 8 Times in 6 Posts
Send a message via MSN to crakez Send a message via Skype™ to crakez
Thanks for sharing your work. You can find the answer to your question regarding daily motion at link below.

http://forums.pligg.com/pligg-mods/8...ion-video.html

Cheers,
John
Reply With Quote
  #123 (permalink)  
Old 08-30-2007, 12:49 PM
New Pligger
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Quote:
Originally Posted by Simon View Post
I tried doing a basic copy of the videos section of digg here. If you click on the video area of the top story at the moment (LOTR), the video should open in a thickbox (light weight version of lightbox). I'll add some basic pointers for what i did:

1.) Edited the 1st step submission template to include radio buttons - article or video. Then added an extra db column to pligg_links (link_type) and edited the store and read functions in libs/link.php to ensure that the value of the radio buttons was recorded / selected in the database. If video was selected, the value was 1, otherwise 0. Added link_type as a smarty variable in the same file.

2.) Edited link_summary.tpl using my newly created {$link_type eq 1} varaible to differentiate posts with videos in, and posts without. So if the value comes back as 1, a small video area with play button is displayed.

3.) Created a file called play.php to the root directory. I added an example below, and it needs the link id appended to the url to work:

Code:
<?php

include('libs/dbconnect.php');

$connect_video = @mysql_connect(EZSQL_DB_HOST, EZSQL_DB_USER, EZSQL_DB_PASSWORD);
$database_video = @mysql_select_db(EZSQL_DB_NAME, $connect_video);

$id = mysql_real_escape_string(strip_tags($_GET['id']));
$play_query = mysql_query("SELECT link_votes,link_url FROM pligg_links WHERE link_id=\"$id\" AND (link_status='published' OR link_status='queued') AND link_type='1' LIMIT 1");
$play = mysql_fetch_array($play_query);
$play_url = $play['link_url'];
$votes = $play['link_votes'];

$close = @mysql_close($connect_video);
 
?>

<div>
<center>
<object width="425" height="350">
<param name="movie" value="<?php echo $play_url ?>"></param>
<param name="wmode" value="transparent"></param>
<embed src="<?php echo $play_url ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
</object>
<br /><br />
<b>Total Votes for this Video:</b> <?php echo $votes ?>
</center>
</div>
4.) Uploaded thickbox, and added the css and js files to the pligg.tpl template. Created a link to play the video (play.php) which included link id, height and width (eg. play.php?id={$link_id}&height=400&width=400), and gave it the attribute class="thickbox". When a user clicks on the link, the video will open in a digg-like window.

5.) Copied the index.php and upcoming.php and renamed to video.php and video-upcoming.php, and did the same with corresponding template files. Created a copy of (and renamed) libs/link_summary.php and edited to only show stories with a link type of 1 - just a simple condition like if($link->type == 1). Then edited the video templates with the renamed files, and that was that.

Demo: http://news.oioplus.com

That's just a basic outline, i'm sure someone can take it and improve upon it.
Can you do this to my site? It's an awesome mod. The site is Pligg Beta 9 / Published News Let me know what your fee is.
Reply With Quote
  #124 (permalink)  
Old 10-08-2007, 03:10 PM
clems365's Avatar
Casual Pligger
Pligg Version: 9.8.2
Pligg Template: CMS Theme
 
Join Date: May 2007
Location: santiago chile
Posts: 60
Thanks: 5
Thanked 9 Times in 6 Posts
About Daily Motion

The code in play.php to daily motion is:

HTML Code:
 // code to display Daily Motion
   if (preg_match("/http:\/\/www.dailymotion.com\/swf\/([0-9a-zA-Z\-\_]*)(.*)/i", $url, $matches)) {
        return '<object width="400" height="316">'.
                        '<param name="movie" value="http://www.dailymotion.com/swf/'.$matches[1].'" />'.
                        '<param name="allowfullscreen" value="true" />'.
                        '<embed src="http://www.dailymotion.com/swf/'.$matches[1].'" type="application/x-shockwave-flash" width="400" height="316" allowfullscreen="true" />'.
                    '</object>';
    }
But for my part it doesn't work... With youtube and google.video I don't have any trouble all is ok, but for daily motion no... Somebody has an idea to resolv this problem

best regards
Clems
Reply With Quote
  #125 (permalink)  
Old 10-08-2007, 03:40 PM
Casual Pligger
Pligg Version: 9.9
Pligg Template: convergence
 
Join Date: Sep 2007
Location: Netherlands
Posts: 41
Thanks: 3
Thanked 8 Times in 4 Posts
Hey Clems,

Looks like Dailymotion changed there short urls

Looking for a solution.

Or just copy the video url from the embed code under the movie

example
PHP Code:
<object width="425" height="252">
<
param name="movie" value="http://www.dailymotion.com/swf/2725G2ThlECwjllVj"></param>
<
param name="allowfullscreen" value="true"></param>
<
embed src="[b]http://www.dailymotion.com/swf/2725G2ThlECwjllVj[/b]" 
type="application/x-shockwave-flash" width="425" height="252" allowfullscreen="true">
</
embed>
</
object
Copy
http://www.dailymotion.com/swf/2725G2ThlECwjllVj
and submit that url as a story. The only drawback is that it doesnt retreive the video name, you have to enter it manualy.

greets thuggster
__________________

Last edited by thuggster; 10-08-2007 at 03:48 PM..
Reply With Quote
  #126 (permalink)  
Old 10-09-2007, 09:51 AM
clems365's Avatar
Casual Pligger
Pligg Version: 9.8.2
Pligg Template: CMS Theme
 
Join Date: May 2007
Location: santiago chile
Posts: 60
Thanks: 5
Thanked 9 Times in 6 Posts
thanks

Ok, it's the solution, but impossible to use with the RSS import, in the Dailymotion RSS the link is different. Bad luck...

An other problem with the RSS import is when I would like to use the RSS video google, the link is to long, more than 255 character... Somebody has an idea to resolv this problem ?

thanks
Clems
Reply With Quote
  #127 (permalink)  
Old 02-09-2008, 08:07 AM
New Pligger
Pligg Version: 9.8.2 Beta
Pligg Template: not sure yet
 
Join Date: Dec 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Same problem! How did you fix this?

Quote:
Originally Posted by mryder View Post
So now my only problem is the video doesn't popup like it's suppose to. It just opens up a new page, with the video playing.

I think it is not recognizing the class="thickbox"? What do I do about that?

EDIT: It works now! :-D finally!
Hi How did you fix this?

I Fixed it... it wasn't referencing to thickbox. In the old instructions there was no reference to Thickbox.css for Link_summary.tpl...

Thanks Simon! It is a great addition to Pligg.

Last edited by TomEV; 02-10-2008 at 05:56 AM.. Reason: found the mistake
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Search Engine Friendly URLs by vBSEO 3.2.0