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.

Archive /

Our old forums are still available as a read-only archive.

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

How to create this PageType i need?


Reply


847 Views

Avatar
SalvaStripe

Community Member, 89 Posts

11 December 2008 at 2:44am

hey there!
i want to create a new PageType what shows the Title and Content of another Page.

If i have an ArticleHolder what controls its children and now i want to add in this listing a children from another ParentSite.. i'll get an Problem. First i tried to add an Redirector Page between the ArticlePages, but the Redirector Page does not show the Content of the Page where it Redirects to.

Sooo.. i want to create a new PageType with a field like "ShowMeThisPage".

class GetPressePage extends Page {
static $db = array(
'Seitevonpresse' => 'Text'
);
static $has_one = array(
);

static $allowed_children = array(
);
   function getCMSFields() {
      $fields = parent::getCMSFields();
      
      $fields->addFieldToTab('Root.Content.Main', new TextField('Seitevonpresse'), 'Seitevonpresse');
      
      return $fields;
   }
   static $defaults = array(
      'ProvideComments' => false
   );
}

In SilverStripe there are nice PageControls like

<% control Page(my-page) %>$Title<% end_control %>

and

<% control ChildrenOf(page-url) %>

for example. I can show my "Seitevonpresse" field, when i write "$Seitevonpresse" in my GetPressePage.ss, but this:

<% control Page($Seitevonpresse) %>$Title<% end_control %>

dows not work! :(

I dont realy understand the "Dataobject::get ..." stuff.. so maybe someone can help me to find a good answer?

SalvaStripe