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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DOM Lightbox shows '1 of 6' even though only 1 image

Go to End

3 Posts   2353 Views


Community Member, 182 Posts

19 January 2010 at 4:16am

Edited: 19/01/2010 5:36am

EDIT: Perhaps there is a better way to use ImageGallery Lightbox on other Page types, then my example below..?

I've altered the DOM example "Testimonials" to include an image field and added the lightbox effect from ImageGallery which is working great apart from one thing...

The lightbox pop-up shows "1 of 6" when there is only one image. Clicking next takes you through the same image six times.

Adding another entry creates "1 of 11", I can't work it out, can someone help? thanks!

These are my files for my EventPage page type (apologies for the long entry):

<link rel="stylesheet" type="text/css" href="image_gallery/gallery_ui/lightbox/css/jquery.lightbox-0.5.css" />
  <link rel="stylesheet" type="text/css" href="/image_gallery/css/ImageGallery.css" /> 
<div id="Content" class="typography">
  <% if Level(2) %>
    <div class="breadcrumbs">
  <% end_if %>			
  	<div id="EventsList"><ul>
				<% control Events %>
				<li id="Events">
						<div id="EventTitle"><h3><% if Link %><a href="http://$Link" target="_blank" alt="$Title">$Title</a><% else %>$Title<% end_if %></h3></div>
						<div id="EventDescription"><p>$Description</p></div>
						<div id="EventLocation">$Location</div>
						<div id="EventDate">$Date.Nice</div>
		  <% if Flyer %><div id="EventImage"><a  rel="lightbox" class="lightbox" title="$Title"  href="$Flyer.URL">
   						<% control Flyer.SetWidth(130) %>
      					<img src="$URL"<% end_control %>alt="$Title"/><% end_if %>
					<div id="Item">

				<% end_control %>
<script type="text/javascript" src="jsparty/jquery/jquery.js"></script>
<script type="text/javascript" src="image_gallery/gallery_ui/lightbox/javascript/jquery.lightbox-0.5.js"</script>
<script type="text/javascript" src="image_gallery/gallery_ui/lightbox/javascript/lightbox_init.js"></script


class EventPage extends Page
	static $has_many = array (
		'Events' => 'Event'
	public function getCMSFields()
		$f = parent::getCMSFields();
		$manager = new DataObjectManager(
			$this, // Controller
			'Events', // Source name
			'Event', // Source class
			array('Date' => 'Date', 'Title' => 'Title', 'Link' => 'Link', 'Location' => 'Location & Time', 'Description' => 'Description', 'Flyer' => 'Flyer'), // Headings
			'getCMSFields_forPopup' // Detail fields function or FieldSet
			// Filter clause
			// Sort clause
			// Join clause
		$f->addFieldToTab("Root.Content.Events", $manager);
		return $f;

class EventPage_Controller extends Page_Controller


class Event extends DataObject
	static $db = array (
		'Date' => 'Date',
		'Title' => 'Text',
		'Link' => 'Text',
		'Location' => 'Text',
		'Description' => 'Text'
	static $has_one = array (
		'EventPage' => 'EventPage',
				'Flyer' => 'Image'

	public function getCMSFields_forPopup()
		return new FieldSet(
			new CalendarDateField('Date'),
			new TextField('Title'),
			new TextField('Link'),
			new TextField('Location'),
			new TextareaField('Description'),
			new ImageField('Flyer')


Forum Moderator, 4102 Posts

19 January 2010 at 4:51am

Is this a bug with DOM or ImageGallery?


Community Member, 182 Posts

19 January 2010 at 4:53am

Edited: 19/01/2010 6:22am

Well im using the DOM mod but including the Lightbox from ImageGallery for images in my DOM page...

Really I'm asking for the best way to use Lightbox from Image Gallery on other Page Types I know there is other posts but none seem to answer in full. I have this working but the image count is wrong... maybe my .ss but havn't found it yet.

missing a </a> in the .ss ................ what can I say dumb. Sorry!