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.

Template Questions /

Reusable Template with Slideshow Banner - where to start?


Reply


3 Posts   1170 Views

Avatar
vwd

Community Member, 160 Posts

22 March 2011 at 6:10pm

Hi,

I'm a SS newbie, and I'm attempting converting an existing static site template into SS. I use this template regularly for new projects, I would like to create a reusable template. One particular component of the the template I'm trying to implement now in my SS template is an image banner (basically, an image slideshow).

My challenge is not with the slideshow part (for which I will use jQuery cycle - I don't necessarily want to specify this at this stage), but to create an easy way for the content editor/theme designer to select the images to go into the slideshow banner (ie. insert a list of <img>'s on the page)

Requirements:

  • Each page on the site will have its unique set of images (for the banner)
  • Provide a means in the CMS admin area to specify the images to be used for each page (either providing a reference to an ImageGallery or explicitly listing the images)
  • The template needs to be modular (obviously) and reusable

Where do I start!!? I don't think I need to create a 'module'. It seems like something I could implement partially in the controller & the template? If so - could someone please point me to a tutorial, reference or example that I can work from please?

Many thanks in advance for any pointers...

VWD.

Avatar
Willr

Forum Moderator, 5513 Posts

22 March 2011 at 9:54pm

... where to start..

You're right, you probably don't need a whole module to do this (although there are a few modules which do image galleries) but you will probably
want to make a custom Page type for your slideshow page. Tutorial 2 covers how to make page types.

By using a page type for your slideshow you can also give it a custom template (with your slideshow html) and also include your javascript file using <% require %>.

For the backend the easiest option would be to link a folder to your page type using a has_one relationship. Then you can get all the files from inside the folder to use as your gallery using the ORM.

http://doc.silverstripe.org/sapphire/en/tutorials/2-extending-a-basic-site
http://doc.silverstripe.org/sapphire/en/tutorials/5-dataobject-relationship-management
http://doc.silverstripe.org/sapphire/en/reference/requirements

Avatar
vwd

Community Member, 160 Posts

22 March 2011 at 10:34pm

Willr, thank you for taking the time to point me in the right direction.

I really appreciate it.

Will look into your suggestions.

Thank you.

VWD.