23368 Posts in 18143 Topics by 2863 members
|Go to End|
5 March 2012 at 10:57pm Last edited: 5 March 2012 11:08pm
Ok... I'm having a bit of trouble to get the template work like the way I wanted. I have searched throught the forum but can not find the anwser
What i'm Trying to do is only display the 1st image within a group (have the same "rel" value), So the image2, image 3 within the same rel would not show unless the Lightbox is open - so you can click on through .
The codes are below:
In the ServicePage.php
static $has_many = array (
'Images' => 'ServicePagePhoto'
public function getCMSFields()
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Images', // Source name
'ServicePagePhoto', // Source class
'Attachment', // File name on DataObject
'Title' => 'Title',
'Description' => 'Description',
), // Headings
'getCMSFields_forPopup' // Detail fields
// Filter clause
// Sort clause
// Join clause
In the ServicePage.ss
<div id="slider" class="mb-slider">
<% control Images %>
<a class="lightbox" title="$Title" rel="$Group" href="$Attachment.URL">
<!----a image2, image3, image 4-->
<% end_control %>
<a href="images/service/door-1.jpg" rel="group1" title="" class="lightbox"> //---This loads first when the lightbox is open up
<img src="images/service/door-big-1.jpg" /> //--- photo displaying (area)
<a href="images/service/door-2.jpg" class="lightbox" rel="group1" title=""></a> //---This loads second when the lightbox is open up
<h3>Door Repaint and Stained<br>
<p>Work was performed in a heritage house located in North Adelaide.</p>
</div> //---Group 1
<a href="images/service/door-3.jpg" rel="group2" title="" class="lightbox">
<img src="images/service/door-big-2.jpg" />
<a href="images/service/door-4.jpg" class="lightbox" rel="group2" title=""></a>
<h3>Door Repair and Repaint</h3>
<p>Main Entry door repainted - Mile End.</p>
</div> //---Group 2
I'm not good at coding and am very new - Yes, an newbie? it would be great If anybody can give me some ideas on this. It has been stuck on my head for weeks...
23 March 2012 at 11:16am
Hi, I think this may give you some ideas, that's how I've got my gallery working. http://www.silverstripe.org/dataobjectmanager-module-forum/show/13085
23 March 2012 at 6:42pm
Thanks for the link!! I did put the tag <% if First %> but didn't help - I think the way I do it is not the right way... the worest case is do this static.. html way
It's currently look like this,
When you click on the picture, the first image is showing in the lightbox, which is not what I wanted...
Still thinking how to make it work...
5 April 2012 at 11:36am
Sorry I haven't been back here for a while. I'm sure there will be a way to achieve what you want to do. I would suggest you to post a new question or be more specific on your question. Sometimes I wait for ages to get a reply.
However I would start to implement the SS to your html step by step if this is my project, and may do some related tutorial on the way if needed.
I'm afraid I'm unable to help you but I hope some other people may be able to give you a hand. Good luck.
|Go to Top|