7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Image Gallery - Latest Images on HomePage?
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 3349 Views |
-
Re: Image Gallery - Latest Images on HomePage?

20 August 2009 at 1:13am
This is another area of ImageGallery that is going to get a good overhaul -- syndication of images to other pages.
Until those changes are implemented, I would just handle that with some display logic on the template.
<% if Pos lt 5 %>
<% end_if %>
Looks like you've extended the Album class. Make sure you isolate your changes in a new class so updates will not overwrite your changes. This would be a good opportunity for you to create your own GalleryItems function, too.
class MyImageGalleryAlbum extends ImageGalleryAlbum
{
static $db = array ('Featured' => 'Boolean');function GalleryItems($limit)
{
return DataObject::get("ImageGalleryItem","AlbumID = $this->ID", $limit);
}
}class MyImageGalleryPage extends ImageGalleryPage
{
protected $albumClass = "MyImageGalleryAlbum";
} -
Re: Image Gallery - Latest Images on HomePage?

20 August 2009 at 2:50pm
Hi - thanks for this info
I added the template code as follows
<% control GalleryItems %>
<% if Pos lt 5 %>
<li>
<a id="ViewLink-$ID" rel="$RelAttr" class="$ClassAttr" title="$Caption" href="$ViewLink">$Image.SetWidth(100)</a>
</li>
<% end_if %>
<% end_control %>Is this correct? I get the following error
Parse error: syntax error, unexpected '}' in C:\Windows\Temp\silverstripe-cacheC--wamp-www-Clients-buffaloclub-www\.cacheC..wamp.www.Clients.buffaloclub.www.themes.buffaloclub.templates.Layout.HomePage.ss on line 163Does Pos lt 5 mean limit to 5? do I need to add a limit variable in my code?
Thanks -
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 1:09am
Change
$Image.SetWidth(100)to
<% control Image %>$SetWidth(100)<% end_control %> -
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 1:10am
No, this isn't an authentic limit clause. "Pos" is the position of the iterator. So the loop will run through all the images, but the display of the image is controlled by a check on the iterator position. Kind of a hack.
-
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 4:33am
Hi, I am having another problem displaying the latest images on the homepage, I did have it all working but when I added latest video as well to the homepage, It stop using lightbox for the images, Is this because the video popup uses shadowbox. because when you click on a video it popups and plays fine. When I go to click on an image, the screen dims like the lightbox is about to come up but does not?
Is this a bug that you cannot have shadowbox and lightbox on the same page or something. I tried just using shadowbox but it is still the same.
FireMe
-
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 5:10am
Check for javascript errors?
-
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 5:20am
Error: uncaught exception: Unknown player: img
?whats that about
-
Re: Image Gallery - Latest Images on HomePage?

21 August 2009 at 3:21pm
Hi
I updated template to <% control Image %>$SetWidth(100)<% end_control %>
but still getting the same errorParse error: syntax error, unexpected '}' in C:\Windows\Temp\silverstripe-cacheC--wamp-www-Clients-buffaloclub-www\.cacheC..wamp.www.Clients.buffaloclub.www.themes.buffaloclub.templates.Layout.HomePage.ss on line 163
I tried a different method based on this post
http://www.silverstripe.org/archive/show/118042?start=0#post118116In my homepage.php - this is a extension of Page as this has several modules being pulled in
(Event Calendar Module (this weeks event) | Image Gallery Module (Featured Images) | Featured Event)public function GalleryItems($limit = 3)
{
$images = DataObject::get("ImageGalleryItem","AlbumID = $this->ID", $limit);
//Debug::show($images);
return $images;
}And in Homepage.ss file
<% control GalleryItems %>
<li>
<a id="ViewLink-$ID" rel="$RelAttr" class="$ClassAttr" title="$Caption" href="$ViewLink"><% control Image %>$SetWidth(100)<% end_control %></a>
</li>
<% end_control %>But still not getting any limit control on images
| 3349 Views | ||
| Go to Top | Next > |


