Example site look:
Start
-first category
--1subcatergory (article holder)
--2subcategrory (article holder)
--3subcategory (article holder)
-second category
--1subcatergory (article holder)
--2subcategrory (article holder)
--3subcategory (article holder)
...
My problem is how to show in 1category or 2category latest articles (ArticlePage) from their (only their) subcategories?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi
You could simply use something like this in your template:
<% control Children.First %>
... output something, eg. $Title
<% end_control %>
This will output the first Child of the current page. The last one could be accessed with Children.Last
i was thinking about some sort of function like in http://doc.silverstripe.com/doku.php?id=recipes:displaying_five_latest_pages_from_multiple_pagetypes or in second tutorial but im not sure exacly how to write it?
In the category pages:
function Latest() {
return DataObject::get_one("ArticleHolder", "ParentID = $this->ID", "Date DESC");
}
Call in your template:
<% if Latest %>
<% control Latest %>
<h3>$Latest.Title</h3>
<div>$Latest.Content</div>
<% end_control %>
<% end_if %>
ok thanks for reply
i make this in hard way
All subcategory have now their own holders and i use then function from recipe "five lates pages"