El Macara Posted September 26, 2010 Report Share Posted September 26, 2010 hi. I am currently using this skin you see here in my virtual airline, and I would put several logos that change automatically. and according to different pages I change the logo change on the other. there I send a picture to see the skin I'm using and tell me how I can do, and details of how to do it please. I appreciate the help immensely .. thanks ... Quote Link to comment Share on other sites More sharing options...
markusr Posted September 30, 2010 Report Share Posted September 30, 2010 Hello, I have tried the following, but I dind't get it working: rotate.php: <?php /* DOWNLOADED FROM http://www.marcofolio.net/ Check it out for more interesting scripts & downloads AUTOMATIC IMAGE ROTATOR Version 2.2 - December 4, 2003 Copyright (c) 2002-2003 Dan P. Benjamin, Automatic, Ltd. All Rights Reserved. http://www.hiveware.com/imagerotator.php http://www.automaticlabs.com/ DISCLAIMER Automatic, Ltd. makes no representations or warranties about the suitability of the software, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. Dan P. Benjamin and Automatic, Ltd. shall not be liable for any damages suffered by licensee as a result of using, modifying or distributing this software or its derivatives. ABOUT This PHP script will randomly select an image file from a folder of images on your webserver. You can then link to it as you would any standard image file and you'll see a random image each time you reload. When you want to add or remove images from the rotation-pool, just add or remove them from the image rotation folder. VERSION CHANGES Version 1.0 - Release version Version 1.5 - Tweaked a few boring bugs Version 2.0 - Complete rewrite from the ground-up - Made it clearer where to make modifications - Made it easier to specify/change the rotation-folder - Made it easier to specify/change supported image types - Wrote better instructions and info (you're them reading now) - Significant speed improvements - More error checking - Cleaner code (albeit more PHP-specific) - Better/faster random number generation and file-type parsing - Added a feature where the image to display can be specified - Added a cool feature where, if an error occurs (such as no images being found in the specified folder) *and* you're lucky enough to have the GD libraries compiled into PHP on your webserver, we generate a replacement "error image" on the fly. Version 2.1 - Updated a potential security flaw when value-matching filenames Version 2.2 - Updated a few more potential security issues - Optimized the code a bit. - Expanded the doc for adding new mime/image types. Thanks to faithful ALA reader Justin Greer for lots of good tips and solid code contribution! INSTRUCTIONS 1. Modify the $folder setting in the configuration section below. 2. Add image types if needed (most users can ignore that part). 3. Upload this file (rotate.php) to your webserver. I recommend uploading it to the same folder as your images. 4. Link to the file as you would any normal image file, like this: <img src="http://example.com/rotate.php"> 5. You can also specify the image to display like this: <img src="http://example.com/rotate.php?img=gorilla.jpg"> This would specify that an image named "gorilla.jpg" located in the image-rotation folder should be displayed. That's it, you're done. */ /* ------------------------- CONFIGURATION ----------------------- Set $folder to the full path to the location of your images. For example: $folder = '/user/me/example.com/images/'; If the rotate.php file will be in the same folder as your images then you should leave it set to $folder = '.'; */ $folder = '/var/www/web97/html/markus/phpvms/lib/skins/crystal-II/rotateimage/'; /* Most users can safely ignore this part. If you're a programmer, keep reading, if not, you're done. Go get some coffee. If you'd like to enable additional image types other than gif, jpg, and png, add a duplicate line to the section below for the new image type. Add the new file-type, single-quoted, inside brackets. Add the mime-type to be sent to the browser, also single-quoted, after the equal sign. For example: PDF Files: $extList['pdf'] = 'application/pdf'; CSS Files: $extList['css'] = 'text/css'; You can even serve up random HTML files: $extList['html'] = 'text/html'; $extList['htm'] = 'text/html'; Just be sure your mime-type definition is correct! */ $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['jpeg'] = 'image/jpeg'; $extList['png'] = 'image/png'; // You don't need to edit anything after this point. // --------------------- END CONFIGURATION ----------------------- $img = null; if (substr($folder,-1) != '/') { $folder = $folder.'/'; } if (isset($_GET['img'])) { $imageInfo = pathinfo($_GET['img']); if ( isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) && file_exists( $folder.$imageInfo['basename'] ) ) { $img = $folder.$imageInfo['basename']; } } else { $fileList = array(); $handle = opendir($folder); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if ( isset( $extList[ strtolower( $file_info['extension'] ) ] ) ) { $fileList[] = $file; } } closedir($handle); if (count($fileList) > 0) { $imageNumber = time() % count($fileList); $img = $folder.$fileList[$imageNumber]; } } if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } else { if ( function_exists('imagecreate') ) { header ("Content-type: image/png"); $im = @imagecreate (100, 100) or die ("Cannot initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0,0,0); imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color); imagepng ($im); imagedestroy($im); } } ?> and in the css: #topBanner { background: url(rotateimage/rotate.php) no-repeat; width: 920px; height: 250px; } It will display only 1 picture and not the random ones. If I open the rotate.php via the webbrowser the rotation is working. But not when only opening / refreshing the website. Maybe some css/php programmer could assist us. thanks a lot, Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 1, 2010 Report Share Posted October 1, 2010 There is a skin that was released here on site that has that feature built in to it. I am thinking you could find it and adapt the code to your skin. I tried it on another skin for the sake of just trying and it worked. I don't recall the name of the skin right now that had that feature. If I find it, I will come back and let you know. Quote Link to comment Share on other sites More sharing options...
markusr Posted October 1, 2010 Report Share Posted October 1, 2010 There is a skin that was released here on site that has that feature built in to it. I am thinking you could find it and adapt the code to your skin. I tried it on another skin for the sake of just trying and it worked. I don't recall the name of the skin right now that had that feature. If I find it, I will come back and let you know. Hello, I have tried it now with the pikachoose script (http://pikachoose.com/download/) in the layout.tpl: <title><?php echo $page_title; ?></title> <link rel="stylesheet" media="all" type="text/css" href="<?php echo SITE_URL?>/lib/skins/crystal-II/styles.css" /> <script type="text/javascript" src="assets/js/jquery.js"></script> <script type="text/javascript" src="assets/js/jquery.pikachoose.js"></script> <script type="text/javascript" src="assets/js/jquery.jcarousel.min.js"></script> <script language="javascript"> <!-- $(document).ready( function (){ $("#pikame").PikaChoose(); $("#pikame").jcarousel({scroll:4, initCallback: function(carousel) { $(carousel.list).find('img').click(function() { //console.log($(this).parents('.jcarousel-item').attr('jcarouselindex')); carousel.scroll(parseInt($(this).parents('.jcarousel-item').attr('jcarouselindex'))); }); } }); }); --> </script> But it won't load the js script. Any idea? I have already made a index.html with the same script code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link type="text/css" href="styles.css" rel="stylesheet" /> <script type="text/javascript" src="assets/js/jquery.js"></script> <script type="text/javascript" src="assets/js/jquery.pikachoose.js"></script> <script type="text/javascript" src="assets/js/jquery.jcarousel.min.js"></script> <script language="javascript"> <!-- $(document).ready( function (){ $("#pikame").PikaChoose(); $("#pikame").jcarousel({scroll:4, initCallback: function(carousel) { $(carousel.list).find('img').click(function() { //console.log($(this).parents('.jcarousel-item').attr('jcarouselindex')); carousel.scroll(parseInt($(this).parents('.jcarousel-item').attr('jcarouselindex'))); }); } }); }); --> </script> </head> <body> <!-- not really needed, i'm using it to center the gallery. --> <div class="pikachoose"> Basic example <ul id="pikame" class="jcarousel-skin-pika"> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/1.jpg"/></a><span>Thanks to <a href="http://web.cara-jo.net">Cara Jo</a> for the awesome new themes!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/2.jpg"/></a><span>jCarousel is supported and integrated with PikaChoose!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/3.jpg"/></a><span>Let me know at jeremy.m.fry@gmail.com if you find any bugs!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/4.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/5.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/1.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/2.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/3.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/4.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/5.jpg"/></a><span>Caption</span></li> </ul> </div> </body> </html> the TPL: <div id="body"> <div id="innerwrapper"> <div class="pikachoose"> Basic example <ul id="pikame" class="jcarousel-skin-pika"> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/1.jpg"/></a><span>Thanks to <a href="http://web.cara-jo.net">Cara Jo</a> for the awesome new themes!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/2.jpg"/></a><span>jCarousel is supported and integrated with PikaChoose!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/3.jpg"/></a><span>Let me know at jeremy.m.fry@gmail.com if you find any bugs!</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/4.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/5.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/1.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/2.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/3.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/4.jpg"/></a><span>Caption</span></li> <li><a href="http://www.pikachoose.com"><img src="/Markus/phpvms/lib/skins/crystal-II/assets/5.jpg"/></a><span>Caption</span></li> </ul> </div> and the TPL won't load the js script.... I only see all pictures below each other and after all pictures the site is shown. thanks for your help. Quote Link to comment Share on other sites More sharing options...
markusr Posted October 1, 2010 Report Share Posted October 1, 2010 got it! i missed this one: <?php /*Any custom Javascript should be placed below this line, after the above call */ ?> <?php echo $page_htmlhead; ?> <script type="text/javascript" src="<?php echo SITE_URL?>/lib/skins/crystal-II/assets/js/jquery.pikachoose.js"></script> </head> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.