Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How to create this PageType i need?

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

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

Page: 1
Go to End
Author Topic: 772 Views
  • SalvaStripe
    Avatar
    Community Member
    89 Posts

    How to create this PageType i need? Link to this post

    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

    772 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.