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.

General Questions

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

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

Different page types under ArticleHolder Page type




4 June 2009 at 1:47am Community Member, 42 Posts

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 =>

<% control Articles %>
   <div id="NewsListL">
   <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 class="clear"></div>
   <% end_control %>

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

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

4. Code in =>

<% control Menu(2) %>
<% if Children %>
<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 %>
<% end_if %>
<% else %>
<a href="$Link" title="$Title" class="$LinkingMode"><span>$MenuTitle</span></a>
<% 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