Jump to:

23013 Posts in 11540 Topics by 2825 members

General Questions

SilverStripe Forums » General Questions » Page Type Buider...?

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

Page: 1
Go to End
Author Topic: 713 Views
  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Page Type Buider...? Link to this post

    Hi,

    there is form builder , but there is a page type builder for extending page base type for making a type usable to create page?

  • CrazyCoders
    Avatar
    Community Member
    32 Posts

    Re: Page Type Buider...? Link to this post

    Unless you want to simply have several templates, there is virtually no need to have a page type builder. Page types are usually to create controllers or additionnal database content to store in the DB. No matter the time involvement to create such a thing, it could never be perfect, so it a little pointless to do so.

    If you want to add page types but don't know programming, know that it is very simple to Copy and Paste the Page.PHP file under "mysite/". You then just open the file and change the "class Page extends SiteTree" for "class xzy extends Page" and you also change the "page_controller extends ...(something)..." to "class xyz_controller extends page_controller".

    Thats all...

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Page Type Buider...? Link to this post

    Hi biapar,

    Our page types are represented as PHP classes, and this would make the creation of a page type editor quite a task - you would need to make a system for generating code, which would need to be extremely robust to ensure that developers' alterations to the code files were never lost. It could be done, but it would be a lot of work and we're focusing our energy elsewhere.

    We don't want to have an option to track extra fields in the database because then it becomes harder for developers to extend those page types with customised functionality. A key design decision of SilverStripe is that we ensure that websites developed with it are extensible and maintainable as a software project. This does mean that we lack certain GUI-based features such as a page type editor, but that's a trade-off we have had to make.

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Page Type Buider...? Link to this post

    I agree that without using predefined or wizard GUI , we have more funny, power and control and with a simple notepad , we are able to write/modified a class page.
    I understand that to add new fields in a SS page ... I must add array and cmsfield codes... and for creating a new type of page template , I must extend a page base class... ( is it ok ? ) - )

  • CrazyCoders
    Avatar
    Community Member
    32 Posts

    Re: Page Type Buider...? Link to this post

    Indeed, creating a page type is as simple as copying this code:

    <?php

    class NewPageName extends Page {
       
       public static $db = array(
       );
       
       public static $has_one = array(
       );
       
    }

    class NewPageName_Controller extends Page_Controller {
       
    }

    ?>

    Into a new file:

    1. Copy the previous code
    2. Change the name of the created class (NewPageName for something else)
    3. Save the file under the name of the class (Case sensitive)
    4. Upload
    5. Run /dev/build
    6. Reload CMS and you are done, you have a new page type

    If you want more customized behavior then you need to read the tutorials or find a programmer willing to help you (This is outside the scope of this forum)

    Cheers

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Page Type Buider...? Link to this post

    Thank you.....

    And for creating new TAB in admin Area?

    713 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.