7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Showing all children from the root
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: | 537 Views |
-
Showing all children from the root

10 August 2010 at 1:51am Last edited: 10 August 2010 1:51am
Hello,
I got the following structure:
1) Home (page.ss)
2) Portfolio (PagePortfolioHolder.ss)
- Catagory 1 (PagePortfolioGroup.ss)
-> Item 1 (PagePortfolio.ss)
-> Item 2 (PagePortfolio.ss)
-> Item 3 (PagePortfolio.ss)- Catagory 2 (PagePortfolioGroup.ss)
-> Item 1 (PagePortfolio.ss)
-> Item 2 (PagePortfolio.ss)
-> Item 3 (PagePortfolio.ss)- Catagory 3 (PagePortfolioGroup.ss)
-> Item 1 (PagePortfolio.ss)
-> Item 2 (PagePortfolio.ss)
-> Item 3 (PagePortfolio.ss)Now the trick is:
I want to the children of the Catagory 1, 2 & 3 to be shown on the Portfolio (PagePortfolioHolder.ss)I have created something like this:
class Page_Controller extends ContentController {
function PortfolioCases($num=999) {
$portfolio = DataObject::get_one("PagePortfolioGroup");
return ($portfolio) ? DataObject::get("PagePortfolio", "ParentID = $portfolio->ID", "Date DESC", "", $num) : false;
}and in the template (PagePortfolioHolder.ss)
<% control PortfolioCases %>
<div id="CaseHolder" class="$ClassName" >
<div id="CaseThumbHolder">
<div id="CaseThumb" style="background-image:url('$Thumbnail.url')">
</div>
</div>
<div id="CaseTextHolder">
<div id="CaseText">
<h2>$Title</h2>
<p>$Content.LimitWordCount(40)</p>
</div>
<div id="CaseButton">
<div id="button_bekijk" OnClick="javascript: window.location = '$Link';" style="cursor: pointer">
</div>
</div>
</div>
</div>
<% end_control %>But it only prints the children of the FIRST catagory.
Why? And how can I fix it so it will print all childeren of all subcatagories?
Thank you!
-
Re: Showing all children from the root

10 August 2010 at 2:50am
I'd love to help you, but before I go any further, I need to know what in God's name happened here:
<div id="button_bekijk" OnClick="javascript: window.location = '$Link';" style="cursor: pointer">
?!?!?!?!?!?!?!
-
Re: Showing all children from the root

10 August 2010 at 3:07am
hehe, I confess: i did that
I wanted the divs to have a hover effect and i want the divs to be clickable.
Got the solution:
function PortfolioCases($num=999) {
return DataObject::get("PagePortfolio", "", "Date DESC", "", $num);
}
| 537 Views | ||
|
Page:
1
|
Go to Top |
