Post by gaidin » Wed Aug 12, 2009 2:55 pm

Hi Everyone

I have found this simple slideshow script and have been successful in getting it to work.

Code: Select all

<script type="text/javascript" src="catalog/view/javascript/simplegallery.js">

/***********************************************
* Simple Controls Gallery- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>

<script type="text/javascript">

var mygallery=new simpleGallery({
	wrapperid: "simplegallery1", //ID of main gallery container,
	dimensions: [500, 400], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
	imagearray: [
		["image/palm_treo_pro_3.jpg", "http://en.wikipedia.org/wiki/Swimming_pool", "_new", "There's nothing like a nice swim in the Summer."],
		["image/nikon_d300_1.jpg", "http://en.wikipedia.org/wiki/Cave", "", ""],
		["image/iphone_3.jpg", "", "", "Eat your fruits, it's good for you!"],
		["image/macbook_1.jpg", "", "", ""]
	],
	autoplay: [true, 2500,999], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
	persist: false, //remember last viewed slide and recall within same session?
	fadeduration: 700, //transition duration (milliseconds)
	oninit:function(){ //event that fires when gallery has initialized/ ready to run
		//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
	},
	onslide:function(curslide, i){ //event that fires after each slide is shown
		//Keyword "this": references current gallery instance
		//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
		//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
	}
})

</script>
The script,I placed in home.tpl of the template. the attached javascript I placed in the Javascript folder and a <Div> in the welcome box to make it appear there. All is well but......

If I need to change templates I have to copy all the codes to the new template.

My questions:

1. Is there somewhere I can place the above script to make it template independent (so slideshow would work across template switching without anymore code editing)

2.As you will noticed from the code, the image filenames are hardcoded so code needs to be edited each time you need to change images. Can anyone give me some hints and ideas how to replace this with variable and get it to read the files in a specific folder eg. /image/slideshow

3. there are settings in the simplegallery.js that controls certain features of the slideshow eg transition time. How would I control these from the admin back-end.

thanks for and help an ideas.

Newbie

Posts

Joined
Sun Jul 26, 2009 5:44 pm

Post by readyman » Wed Aug 19, 2009 4:57 am

1. You can probably put all the slideshow code in the welcome message area.

2. The hardcoded portion of the script is a feature of the simple gallery script that you downloaded. You will need to edit it if you want to change the images. Either separate the code to a javascript file for easier editing, or run it all from one location (eg. the home page message area)

3. You'll need to custom code it into the admin if you want to control this script from the admin. I think I've seen a contribution for this already. I'm going to work on one that uses jquery, but I haven't got anywhere with it yet.

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by Aquacide » Thu Aug 20, 2009 3:01 pm

gaidin,

do you think that you could post a link to your site so i could see how you implemented this

thanks either way

Matt Egenes
http://www.aquacide.com/OpenCart
(my opencart site is still way in progress)


User avatar
Newbie

Posts

Joined
Tue Aug 11, 2009 5:40 pm

Who is online

Users browsing this forum: No registered users and 7 guests