How to do the YouTube Video Cycle!
As you might know by now, I'll be presenting a session at Do It With Drupal on December 10. If you didn't know, get a ticket, and then come back here! I'm currently building a YouTube clone with Drupal in my spare time. When I'm done with it all, I get to come talk with you folks about how I did it.
Obviously, I'm not going to replicate the entire YouTube site. There comes a point of diminishing returns, especially for something I'm doing for fun. So I have to pick and choose what pieces to build. (For the record, there will also be parts that I believe will be improvements on YouTube; not difficult, since I'm building it with Drupal.)
The video slide show on YouTube's front page would have been a case-in-point. It's built in Flash, and I figured I would skip it, since it's just eye candy. Normally for that, I would use jCarousel or Views Slideshow, but neither replicates YouTube's functionality, and they seemed out of place for this slider that slides 5 videos at a time. But then I remembered someone telling me about the jQuery Cycle plug-in, by the same author of the jQuery Media plug-in.
How I Did It (in 20 minutes, nonetheless)...
The solution isn't completely straight-forward, because of needing to switch out 5 items at a time. However, Views 2 has some really great tools to help out there.
After installing the modules I need (jQuery Plugins, which includes the jQuery Cycle plug-in, and jQ, which offers a unified developer's library and will offer a hopefully easy upgrade to Drupal 7's upcoming core Centralized jQuery plug-in manager), I rolled up my sleeves (and Firebug for examining the style elements).
First, I built a view with 25 nodes, so it could be easily divided by the 5 thumbnails in the slide show. It's sorted by the daily most popular. I'm not sure how YouTube chooses their "Videos being watched right now", but I figure this will give a fair rendition.
While building the view, you'll notice a little link labeled Theme: Information. Become friends with Theme: Information. She will help you solve some otherwise tough problems if you get to know her.
I clicked on that little link, and was presented with a long list of candidate theme template overrides. I took a quick look over, and decided on a Style output template, which prints out each row of data. I then simply overrode that template to split the rows into groups of five, and to invoke the jQuery Cycle plug-in.
<?php
// $Id$
/**
* @file views-view-unformatted--videos--block-4.tpl.php
* Default simple view template to display a list of rows.
* The filename corresponds to this particular view; if reproducing on your own site,
* you'll need to choose an appropriate file from the Style output group of Theme: Information.
*
* @ingroup views_templates
*/
// Make sure the jQ module is enabled, so we don't get PHP errors if we disable it in the future.
if (module_exists('jq')) {
// I'm using jq_add here. It assumes you have the jQuery Cycle plug-in installed. That plug-in
// comes bundled with the jQuery Plugins module, but you could also just drop it into a
// /plugins or /sites/example.com/plugins folder and call it with the same method.
jq_add('cycle');
// Here's the actual call for our cycle slide show plug-in.
// I'm using the 'shuffle' effect, shifting the images w/ top & left, slowing it from the default
// with 'timeout', and using 'pause' to allow a pause on mouse hover. There are lots of cool
// effects; see the plug-in home at malsup.com/jquery/cycle/.
$js = <<<js
$('#cycle-videos-$id').cycle({
fx: 'shuffle',
shuffle: {
top: 30,
left: 15,
},
pause: 1,
timeout: 10000
});
js;
// Make it degrade gracefully in non-javascript browsers.
$js = "if (Drupal.jsEnabled) { $(document).ready(function() { $js }); }";
drupal_add_js($js, 'inline');
}
?>
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<div id="cycle-videos-<?php print $id; ?>">
<?php
$count = 0;
$row_count = 0;
// Cycle through all our divs.
while ($count < sizeof($rows)) {
// Each of these divs will be a separate frame in the cycle slide show.
print '<div id="cycle-videos-'. $id .'-'. ($row_count++) .'" class="cycle-videos">';
$inner_count = 0;
// Now display 5 rows of data, each of which is just a thumbnail in this case.
// Note this slide show is not limited to images. It could be text, videos, whatever.
while ($inner_count < 5 && $count < sizeof($rows)) {
print '<div class="'. $classes[$id] .'">'. $rows[$count++] ."</div>\n";
$inner_count++;
}
print "</div>\n";
}
?>
</div>Finally, I cleaned up the CSS. That took over half of the time. I'm not going to explain that here. If you want to know how I did it, you can use Firebug to look at it from your browser.
That's it! You can see the results at YouDrup. (That site is still in progress, so wear your construction hat.)
I look forward to seeing you at Do It With Drupal next month! (I'll also be at DrupalCamp Philly next week and at DrupalCon DC in the spring if you can't make that.)

Drupal Multimedia, by Aaron Winborn, Available Now!
صور اسلامية
مسجات مضحكه 2013
مسجات نكت 2013
مسجات نكت
رسائل نكت
رسائل نكت 2012
رسائل نكت 2013
رسائل مقالب 2012
رسائل مقالب 2013
نكت مصرية
رسائل نكت مصرية
رسائل نكت مصرية 2012
رسائل نكت مصرية 2013
صور رومانسية
صور رومانسيه
صور رومانسية جديدة
صور حب رومانسية
صور حب رومانسيه
صور اسلاميه
صور اطفال
صور اطفال مضحكة
صور اطفال مضحكه
اطفال مضحكة
اطفال مضحكه
صور اطفال 2012
صور اطفال جديدة
صور اطفال حزينة
احلى صور اطفال
صور اطفال حلوة
اجمل صور اطفال
صور اطفال 2013
اجمل اطفال
صور طفل جميل
صور اطفال روعه
صور اطفال رومانسية
صور حب اطفال
صور انمى متحركة
صور انمى متحركة 2013
صور كيوت انمى 2013
صور كيوت انمى
صور اطفال حلوين
صور اطفال صغار
صور اطفال صغار 2012
صور انمى جديدة 2012
صور انمى بنات
صور انمي سراب
صور بنات انمي 2013
صور رمزيات بنات انمى
برودكاست 2012
برودكاست 2013
برودكاست بلاك بيري جديدة
برودكاست حزين
برودكاست حب
برودكاست حب 2012
برودكاست عيد ميلاد
برودكاست للصباح
برودكاست بلاك بيري
برودكاست بلاك بيري والتس اب
برودكاست حلوه 2013
برودكاست شوق
برودكاست خواطر
برودكاست عتاب 2012
رودكاست عتاب
برودكاست نكت
برودكاست نكت 2012
برودكاست عشق 2012
ترددات النايل سات
ترددات النايل سات 2012
ترددات القنوات 2013
windows 8
تحميل فايرفوكس 12
صور ماسنجر
برامج ماسنجر 2012
توبيكات حزينه 2012
توبيكات حزينه
توبيكات حزينة
توبيكات شعر 2012
توبيكات شعر 2012
توبيكات عتاب
خلفيات ايفون ورد
خلفيات ايفون كيوت
رسائل صداقة 2012
رسائل صداقة
رسائل قبل النوم 2012
رسائل قبل النوم
رسائل فراق 2013
رسائل فراق
رسائل فراق 2012
رسائل غرامية 2013
رسائل غرامية
رسائل غرامية 2012
شات وليد
رسائل عشق 2012
رسائل عشق
رسائل مصرية
رسائل حب مصرية 2012
رسائل حب مصرية
رسائل خطوبة
رسائل خطوبة 2013
رسائل خطوبة 2012
رسائل حزن 2013
رسائل حزن 2013
مسجات حب 2013
رسائل موبايل اجنبيه 2013
رسائل موبايل اجنبيه
رسائل جرح
رسائل جرح 2013
رسائل سماح 2012
رسائل سماح
رسائل مسامحه
فساتين سهره
الفيس بوك
الفيس بوك 2012
الفيس بوك 2013
الفيس
فيس بوك
فيس بوك 2013
فيس بوك 2012
صور الفنانين
صور ممثلين 2012
صور مطرين
صور فنانين 2012
صور فنانين
صور اصالة نصرى
صور اصالة نصرى 2012
صور شيرين احمد
صور شيرين احمد 2012
صور شيرين احمد 2013
صور عادل امام
صور عادل امام 2013
صور ياسمين نيازى
رسائل حب وغرام
مسجات حب
مسجات حب 2013
رسائل اعتذار
رسائل اعتذار 2012
رسائل اعتذار 2012
رسائل عتاب
رسائل عتاب 2013
رسائل عتاب 2012
رسائل عتاب
رسائل حزينة
رسائل حزينة 2012
رسائل سماح
العاب ايفون
العاب ايفون 2012
برامج ايفون
خلفيات ايفون كيوت 2013
خلفيات ايفون جديده
خلفيات ايفون 2012
خلفيات ايفون خقق 2012
خلفيات ايفون خقق
صور بشرى 2013
صور جمانة مراد 2012
صور جمانة مراد
صور جمانة مراد 2012
صور الفنانة قمر 2012
صور منة فضالى 2013
صور منة فضالى
صور هند صبرى 2013
صور هند صبرى
صور اصاله 2013
اجدد صور الفراق
اجدد صور حزينه
اجدد صور حزن
اجدد صور فراق
اجدد صور حزن وفراق
صور الفراق 2012
صور الفراق جديدة 2012
صور الفراق 2012 جديدة
صور حزينه 2012
صور حزينة 2012
صور وداع 2012
صور وداع
اجمل صور الفراق
صور الفراق 2013
احلى صور الفراق
صور حزينه رومانسية 2013
صور حزن 2013
صور حب للعشاق
ابراج الحظ 2012
حظك اليوم
الابراج الفلكية
برجك اليوم
الابراج 2012
دردشة الحب
دردشه الحب
شات الحب
I mean thats basically what it does already but in a "hardcoded" way; all external URL's are downloaded.
I really do not recommend wampserver, I never use apache2triad and I found an error during the installation of drupal, I had thought that drupal can not walk on apache2triad, but when I tried to install wordpress, same thing happened, I am constantly looking for where is the mistake I did. was there anything that surprised me, where I found that the apache2triad was still using php4. I am currently using xampp, and so far I have not found the error as was the case when I use apache2triad.
دردشة الحب
دردشه الحب
شات الحب
Thank you for your contributions and for the work you continue to do. You are in our thoughts.
دردشة الحب
دردشه الحب
شات الحب
دردشة الحب
دردشه الحب
شات الحب