Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

slideshow integration with imagegallery-UC Please help me


Go to End


15 Posts   4064 Views

Avatar
Rishi

Community Member, 97 Posts

25 February 2010 at 2:43am

hello PatJnr
by saying this "able to use the images uploaded from cms admin panel" i mean to say that if i am uploading 3 images from my admin panel then all the images are showing at once.

thanks for the guidance i will give a try with your code .thank for the help hope this work.Will post the result

Avatar
jseth

Community Member, 98 Posts

20 March 2010 at 7:58am

Hi. I'm trying to follow your suggestion, and I'm pretty sure it's what I need, I'm just not certain about the implemetation. I've created a "slideShow.php" in my /mysite/code folder file using your first group of code - is this correct? I've added the second group of code to my Page.php file, also in the same folder. I've found some scripts for js slideshows, and have created the js file (the file that is supposed to go in the head section) and placed that in the /mysite/javascript folder, and pointed the Requirements statement to that file. When I put the code that is supposed to go in the body into the HTML section of my page in the CMS, it also disappears. I also have the Image Collection module - do I need to get rid of that for this to work. I apologize for asking what may seem like very dense questions, but I am not as code savvy as you guys appear to be. Thank you for your patience.

Avatar
Rishi

Community Member, 97 Posts

21 March 2010 at 3:07am

hello jseth
we both are on the same ship even i am not that much code savy,
you have done almost everything correctly except the last part of coding
all the coding which is given here will come inside the page you have created.
the only thing is the later part will go inside the controller

the code should be like this

class slideShow extent Page
{
static $has_many = array(
'Images' => 'Resource'
);

public function getCMSFields() {
$f = parent::getCMSFields();
$fileMan = new ImageDataObjectManager(
$this,
'Images',
'Resource',
'Attachment',
array(
'Name' => 'Name',
'Description' => 'Description'
),
'getCMSFields_forPopup'
);
$fileMan->setAllowedFileTypes(array('jpg'));
$fileMan->setGridLabelField('Name');
$fileMan->setPluralTitle('Images');
$fileMan->setAddTitle( 'slideshow image' );
if(!$this->Parent){
$f->addFieldToTab("Root.Content.SlideShowImages", $fileMan);
$f->addFieldToTab("Root.Content.SlideShowImages", new HeaderField(
$title = "Slide Show Images",
$headingLevel = "2"
));

}

return $f;
}

class slideShow_Controller extends Page_Controller {

function init() {
parent::init();
Requirements::javascript("you/Script/Address.js");
Requirements::set_write_js_to_body(false);
}

}

Please check out the curly braces whether they r correct or not.
and make sure that the path of js is given corretly.
No need to make any changes in Page.php

hope this helps you

Avatar
jseth

Community Member, 98 Posts

23 March 2010 at 1:27am

Hi Rishi,
Ok, it's quickly apparent that my ship is way behind yours! Excuse my really dumb question, but when you say "the only thing is the later part will go inside the controller ", what then is "the controller"? I guess I need you to tell me exactly where the code goes - see, I'm WAY behind you! Thanks.

Avatar
patjnr

Community Member, 102 Posts

23 March 2010 at 3:49am

Hi jseth

Sorry you are getting lost but help me understand you problem better.
What slideshow a you trying to implement. and if you are getting any error please paste them and it will be easy to help you.
I dont want to give you my code because it will take you time to understand than fix the one you have being working on.

paste it and let's see.

tx

Pat

Avatar
jseth

Community Member, 98 Posts

23 March 2010 at 7:29am

Edited: 23/03/2010 7:30am

Hi Pat,
I don't have any code in particular that I love; I'm used to using, say something from dynamicdrive.com, but that won't work the same with silverstripe. I put <iframe> code in the page where I wanted the slideshow and that worked fine if I wanted to click thumbnails to advance the slides, but I want them to fade out to the next slide, but implementing that looks like it takes more coding skill then I have at this time. I have looked at http://doc.silverstripe.org/doku.php?id=controller, but I would need much more time to practice and digest that tutorial than I have right at this time. I think we're going to just with a swf and be done with it! Thanks for your help.

Avatar
jseth

Community Member, 98 Posts

23 March 2010 at 8:24am

Ok, I've found some code that would work well for what I want to do, but I don't know how to make it work. Here are the instructions and code. Would you know how to translate this into "silverstripe"? Thanks.

Step 1: Insert this into the <head> section of your page. Configure the images and corresponding links.

<script language="JavaScript1.1">
<!--

//*****************************************
// Blending Image Slide Show Script-
// © Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("image1.gif","image2.gif","image3.gif")

//specify corresponding links
var slidelinks=new Array("http://www.dynamicdrive.com","http://javascriptkit.com","http://www.geocities.com")

var newwindow=1 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder=new Image()
imageholder.src=slideimages
}

function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}

//-->
</script>

Step 2: Insert the below into the <body> section of your page:

<a href="javascript:gotoshow()"><img src="image1.gif" name="slide" border=0 style="filter:blendTrans(duration=3)" width=97 height=100></a>

<script language="JavaScript1.1">
<!--

var whichlink=0
var whichimage=0
var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+blenddelay)
}
slideit()

//-->
</script>

<p align="center"><font face="arial" size="-2">This free script provided by<br>
<a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>

Go to Top