7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Rotating Banners from specific folder
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 986 Views |
-
Rotating Banners from specific folder

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.
-
Re: Rotating Banners from specific folder

20 August 2010 at 2:32pm
public function Banners() {
$folder = Folder::findOrMake("image-gallery/Banners");
return DataObject::get("Image", "ParentID = $folder->ID");
} -
Re: Rotating Banners from specific folder

20 August 2010 at 2:52pm Last edited: 20 August 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> -
Re: Rotating Banners from specific folder

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.
| 986 Views | ||
|
Page:
1
|
Go to Top |

