[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: www/sites/www-devel
From: Sayak Banerjee <sayakb () ubuntu ! com>
Date: 2010-06-12 19:36:40
Message-ID: 20100612193640.89816AC8CF () svn ! kde ! org
[Download RAW message or body]
SVN commit 1137426 by sayakb:
Add a working version of teaser dynamic image population
M images/teaser/slide1.jpg
M images/teaser/slide4.jpg
M +1 -0 media/includes/chihuahua/css.php
M +6 -10 media/includes/chihuahua/template-top1.inc
M +39 -5 media/includes/classes/class_teaser.inc
--- trunk/www/sites/www-devel/media/includes/chihuahua/css.php #1137425:1137426
@@ -109,6 +109,7 @@
background-repeat:repeat-y;
background-position:top center}
.content .teaser { height: 300px; width: 830px; display: block; margin: auto; }
+ .content .teaser_hide { display: none; }
.content a { color: #235E9A; }
.footer { text-align: left;
--- trunk/www/sites/www-devel/media/includes/chihuahua/template-top1.inc \
#1137425:1137426 @@ -63,9 +63,12 @@
$(document).ready(function() {
$('.sub').hide();
$('.toggle').show();
+ $('.teaser_hide').css('display', 'block');
<?php if (isset($teaser)) { ?>
- jQuery.preLoadImages("/images/teaser/slide1.jpg", "/images/teaser/slide2.jpg", \
"/images/teaser/slide3.jpg", "/images/teaser/slide4.png",
- "/media/images/plasmaMenu/menubox_top.png", \
"/media/images/plasmaMenu/menubox_body.png", + // You need to add a comma after the \
php function output if there are more entries + jQuery.preLoadImages(<?php \
$teaserImages->imageList(); ?>, + "/media/images/plasmaMenu/menubox_top.png", \
+ "/media/images/plasmaMenu/menubox_body.png",
"/media/images/plasmaMenu/menubox_bottom.png");
$('.teaser').cycle({
fx: 'scrollUp',
@@ -107,12 +110,5 @@
<?php } ?>
});
- </script><?php if (isset($teaser)) { ?>
- <!--<img id="next" src="media/images/ss-up.png" alt="" style="display: none; \
position: absolute; z-index: 9999;" />
- <img id="previous" src="media/images/ss-dn.png" alt="" style="display: none; \
position: absolute; z-index: 9999;" />-->
- <span class="teaser">
- <img src="images/teaser/slide4.jpg" alt="" />
- <img src="images/teaser/slide1.jpg" alt="" />
- <img src="images/teaser/slide2.jpg" alt="" />
- </span><?php } ?>
+ </script><?php if (isset($teaser)) $teaserImages->generate(); ?>
<div id="main">
--- trunk/www/sites/www-devel/media/includes/classes/class_teaser.inc \
#1137425:1137426 @@ -11,16 +11,48 @@
//
function generate()
{
- echo '<span class="teaser">';
+ $flag = false;
+ // Start away
+ echo "\n<span class=\"teaser\">\n";
+
+ // Get a list of files
$files = $this->getFiles();
+ foreach ($files as $file)
+ {
+ // Print the images
+ echo "\t<img " . ($flag ? "class=\"teaser_hide\" " : "") . \
"src=\"/images/teaser/{$file}\" alt=\"\" />\n";
+ if (!$flag)
+ {
+ // Set the flag
+ $flag = true;
+ }
+ }
+
+ // That's it!
+ echo "</span>\n";
+ }
+
+ //
+ // Function to print a raw image list
+ //
+ function imageList()
+ {
+ $out = "";
+
+ // Get a file list
+ $files = $this->getFiles();
foreach ($files as $file)
{
- echo "<img src=\"/images/teaser/{$file}\" alt=\"\" />";
+ $out .= "\"/images/teaser/{$file}\",";
}
- echo '</span>';
+ // Trim the last comma
+ $out = substr($out, 0, strlen($out) - 1);
+
+ // Output the list
+ echo $out;
}
//
@@ -28,14 +60,16 @@
//
function getFiles()
{
+ global $document_root;
+
// Get a blank array
$fileList = array();
// Get a list of files
- foreach (array_diff(scandir("/images/teaser/"), array('.','..')) as $file)
+ foreach (array_diff(scandir("{$document_root}/images/teaser"), \
array('.','..')) as $file) {
// If it is a jpg file
- if (is_file("/images/teaser/{$file}") && ereg('jpg$', $file))
+ if (is_file("{$document_root}/images/teaser/{$file}") && \
ereg('jpg|jpeg|png|gif$', $file)) {
// Append the file to the array
$fileList[] = $file;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic