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.

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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Different page types under ArticleHolder Page type


Go to End


1182 Views

Avatar
Anaya

Community Member, 42 Posts

4 June 2009 at 1:47am

Hi Guys,

I am trying to add Page, Calendar and ArticlePage page types under ArticleHolder page type.
But dont want ArticlePages in my left navigation...

1. Following is the code used in ArticleHolder.php =>
class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);

static $allowed_children = array("Page", "Calendar");
}

2. To add articles on ArticleHolder page - following code is used in ArticleHolder.ss =>

<% control Articles %>
<div id="NewsListL">
$Photo.SetWidth(85)
</div>
<div id="NewsListR">
<a href="$Link" title="Read more on &quot;{$Title}&quot;" class="title">$Title</a><br/>
<span class="newsDate">$Date.Nice</span><br/>
$Content.FirstParagraph <a href="$Link" title="Read more on &quot;{$Title}&quot;">Read more &gt;&gt;</a>
</div>
<div class="clear"></div>
<% end_control %>

3. And in Page.php - I am using following code =>

function Articles() {
return DataObject::get('ArticlePage');
}

4. Code in Sidebar.ss =>

<% control Menu(2) %>
<% if Children %>
<li>
<a href="$Link" title="$Title" class="$LinkingMode">$MenuTitle<span class="greenArrow">&raquo;</span></a>
<% if LinkOrSection = section %>
<ul id="SidebarMenu1">
<% control Children %>

<li><a href="$Link" title="$Title" class="$LinkingMode"><span>$MenuTitle</span></a></li>

<% end_control %>
</ul>
<% end_if %>
</li>
<% else %>
<li>
<a href="$Link" title="$Title" class="$LinkingMode"><span>$MenuTitle</span></a>
</li>
<% end_if %>
<% end_control %>

Is there any way not to include Article pages in left navigation on ArticleHolder page or any of its sub pages????

Kind Regards
Anaya...