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, biapar, Willr, Ingo, swaiba, simon_w

Rotating Banners from specific folder


Reply


4 Posts   1280 Views

Avatar
jparks

Community Member, 7 Posts

20 August 2010 at 2:06pm

After way too many hours of scouring ... I come to the forum for help. This is not a hard request but I simply can't figure it out.

I installed DOM and SWFUPLOAD and ImageGallery and everything works great. Uncle Cheese rocks!

I created an album called Banners. The idea is for an individual to access SS CMS and upload a banner that will then automatically be displayed on the homepage. I have the jquery working that rotates the banners and if i drop the absolute url of the pic in there everything works.

But I can not within my HomePage.php establish the correct query nor the correct control in the HomePage.ss

What is the best way to display everything that is being dropped into a specific folder "assets/image-gallery/Banners" and have it displayed on the HomePage.

Thank you for your help.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

20 August 2010 at 2:32pm

public function Banners() {
$folder = Folder::findOrMake("image-gallery/Banners");
return DataObject::get("Image", "ParentID = $folder->ID");
}

Avatar
jparks

Community Member, 7 Posts

20 August 2010 at 2:52pm

Edited: 20/08/2010 3:51pm

Thank you for the quick response ...

Here is what I have tried ... and I am still missing something because it is not working
----------------------
HomePage.php

<?php
/**
* Defines the HomePage page type
*/

class HomePage extends Page {
static $db = array(
);

static $has_one = array(
);

public function Banners() {
$folder = Folder::findOrMake("image-gallery/Banners");
return DataObject::get("Image", "ParentID = $folder->ID");
}
}

class HomePage_Controller extends Page_Controller {

}
?>

---------------------------------
HomePage.ss

......
<body>
<div id="container">
<div id="main">
      <div id="wrapper">
         <div id="slider">
         <% control Banners %>
         <img src="$URL" />   
         <% end_control %>      
         </div>
      </div>
$Content
</div>
<div id="right">
</div>
</div>
</body>
</html>

Avatar
jparks

Community Member, 7 Posts

20 August 2010 at 5:43pm

Thank you Uncle Cheese ... I reviewed my code and everything is working. You got me going in the right direction.

Muchas Gracias.