Active
Project:
BlueMasters
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2012 at 18:09 UTC
Updated:
30 Nov 2012 at 10:55 UTC
I was asked to show the slides by random. This is not necessary with three slides but if there are more slides the user maybe will not wait for the last ones
so here the code
first I would suggest to include the slideshow from a file
.....
<div class="main_view">
<?php include('slideshow.php');?>
<!-- <div class="window">
here was the original slideshow ->
........
-->
(better would be a sql based user interface ;-) )
and here the code for the slideshow (sorry I do not know why the code is crowded in the code box :-(:
<?php
// write the slides in an array: its better now because the related parts are one block
$slides = array (
array (
'image_reel_node' => 'any/file1.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-1.jpg',
'desc' => 'Klicken Sie in das Bild für Baseball Schnick Schnack',
'paging' => 'Slidetext 1'),
array (
'image_reel_node' => 'any/file2.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-2.jpg',
'desc' => 'Klicken Sie in das Bild für Accessoires',
'paging' => 'Slidetext 2'),
array (
'image_reel_node' => 'any/file3.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-3.jpg',
'desc' => 'Klicken Sie in das Bild für Teamoutfits',
'paging' => 'Slidetext 3'),
array (
'image_reel_node' => 'any/file4.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-4.jpg',
'desc' => 'Klicken Sie in das Bild für Sweat/Strick',
'paging' => 'Slidetext 4'),
array (
'image_reel_node' => 'any/file5.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-5.jpg',
'desc' => 'Klicken Sie in das Bild für Caps/Mützen',
'paging' => 'Slidetext 5'),
array (
'image_reel_node' => 'any/file6.php',
'image_reel_slide' => 'sites/all/themes/bluemasters/images/slide-image-6.jpg',
'desc' => 'Klicken Sie in das Bild für Caps',
'paging' => 'Slidetext 6')
);
//start the random number generator for php below 4.2.0
// think less server are using 4.2 or lower
// since 4.2.0 The random number generator is seeded automatically.
//srand ( (double)microtime () * 10000000 );
shuffle ( $slides );
?>
<!-- build the original html structure -->
<div class="window">
<div class="image_reel">
<?php for ( $x = 0; $x < count ( $slides ); $x++ ){ ?>
<a href="<?php echo $slides[$x]['image_reel_node'];?>"><img src="<?php echo $slides[$x]['image_reel_slide'];?>"></a>
<?php }?>
</div>
<div class="descriptions">
<?php for ( $x = 0; $x < count ( $slides ); $x++ ){ ?>
<div class="desc" style="display: none;"><?php echo $slides[$x]['desc'];?></div>
<?php }?>
</div>
</div>
<div class="paging" style="display: block;">
<?php for ( $x = 0; $x < count ( $slides ); $x++ ){ ?>
<a rel=<?php echo $x+1;?> href="<?php echo $slides[$x]['image_reel_node'];?>" class=""><?php echo $slides[$x]['paging'];?></a>
<?php }?>
</div>
Comments
Comment #1
skounis commentedetron770, thank you for posting this.
Let's consider to include this feature in the forthcoming release.
Comment #2
skounis commentedComment #3
etron770 commentedI was asked to add a promotion slide every second slide