21301 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1072 Views |
-
BreadCrumbs for new page types

14 January 2009 at 5:08am
I have created my own page types, NewsHolder and NewsItem. I have created pages so NewsItem is a child of NewsHolder.
But when I use $BreadCrumbs, the parent link in the breadcrumbs does not show.What am I doing wrong? Do I need to override the getParent() function?
Here is my code:
<?php
class NewsHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array("NewsItem");
static $default_child = "NewsItem";
static $can_be_root = false;
}class NewsHolder_Controller extends Page_Controller {
function init() {
parent::init();
}
}?>
<?phpclass NewsItem extends Page {
static $db = array(
'Date' => 'Date'
);
static $has_one = array(
);
static $allowed_children = "none";
static $default_parent = "news";
static $can_be_root = false;
static $icon = "mysite/images/treeicons/news";function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
return $fields;
}
}class NewsItem_Controller extends Page_Controller {
function init() {
parent::init();
}
}?>
-
Re: BreadCrumbs for new page types

17 January 2009 at 9:06am
Just a question: I suppose 'newsholder' is a subpage as well? (as you've made can_be_root = false).
Normally breadcrumbs works out of the box.
You don't even need to put in the init() function everytime in the controller again, when all you do is calling parent::init();
-
Re: BreadCrumbs for new page types

21 January 2009 at 4:12am Last edited: 21 January 2009 4:12am
The problem was that "Show in menu?" option was not checked for the NewsHolder page.
| 1072 Views | ||
|
Page:
1
|
Go to Top |


