Jump to:

3447 Posts in 1032 Topics by 872 members

Template Questions

SilverStripe Forums » Template Questions » Add new Page Type in Behavior Tab?

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

Page: 1 2
Go to End
Author Topic: 5387 Views
  • Gina
    Avatar
    Community Member
    11 Posts

    Add new Page Type in Behavior Tab? Link to this post

    Site is http://www.radimage.com
    I have been abandoned by my developer and am a mere designer! My Radia pages need a different footer to appear than the rest of the site. I found the file he used for the footer. I also see that all the page types match the names of these .ss files (Page.ss, SearchForm.ss, etc.) I saw this code in the Page.ss file:

    <% include footer %>

    I made a copy of the footer.ss, renamed it RadiaFooter.ss, Made a copy of the page.ss, named it RadiaPage.ss that calls up the new footer and uploaded it. My thinking was that I could then see the new"Radia Page" in the page type drop down under the behavior tab. Clearly I am a dreamweaver hack in way over my head!!! How do you create and then get a new page type to show up in the behavior tab? Let me know if I need to copy and paste or attach code here.

    Thanks, Gina
    gina@bellandigroup.com

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    If you make changes to any template you have to flush the template cache by apending ?flush=all to your url.

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    To create a new pagetype you need to create the file in the mysite/code folder. Thats the the folder that determins the page type. The ss files are only the templates for the various page types.

    The basic code any new pagetype needs is (replace the * with the pagetype name ie RadiaPage

    <?php
    /**
    * Defines the HomePage page type
    */

    class * extends Page {
    static $db = array(
    );
    static $has_one = array(
    );

    }

    class *_Controller extends Page_Controller {
       
    }
    ?>

    If you go through the tutorials it should give you the knowlege you need to get the basic stuff done.

    http://doc.silverstripe.org/doku.php?id=tutorial:1-building-a-basic-site

  • Gina
    Avatar
    Community Member
    11 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    Thanks so much for trying to help me. Unfortunately, it didn't work. I saw that our home page had the EXACT code you typed except for that page type name so I know your advice is sound. I copied and pasted, edited the name to "RadiaPage" and uploaded, then flushed the cache. Still not showing up in that behavior tab. I see all the other page types there so I must be doing something seriously wrong.

    I'm close to having to fork out mega bucks to the SS developers at this point so it's worth my flailing around a bit before I admit defeat. :o)

  • Gina
    Avatar
    Community Member
    11 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    Take it back - IT WORKED!! You are my hero (saved me from hiring the guys down under for big $$)

    Note to the nubies - it didn't at first until I found/did this :
    Visit (mysite)/dev/build?flush=1

    Visiting db/build runs a script that will check the database schema and update it as necessary. Putting ?flush=1 on the end makes sure that nothing that’s linked to the old database structure will be carried over. If things aren’t saving, pages aren’t loading, or other random things aren’t working it’s possible that the database hasn’t been updated to handle the new code. Here are some specifics situations:

    You’ve created a new page type / other data object type
    You’ve change the type of one of your database fields
    You’ve published a new copy of your site
    You’ve upgraded your version of SilverStripe

    I didn't know there were different "flush" procedures so that fixed it. YAY!

  • kurt
    Avatar
    Community Member
    2 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    I have created the php file in the correct location. However, when I attempt to flush the database with www.mysite.com/dev/build?flush=1 I get a page not found error. Doesn't make any difference whether I am logged into the CMS or not.

    I do not have a localhost installation of the web site. I am working remotely.

  • zenmonkey
    Avatar
    Community Member
    528 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    Is it a standard 404 error or Silverstripe Error?

  • kurt
    Avatar
    Community Member
    2 Posts

    Re: Add new Page Type in Behavior Tab? Link to this post

    It's a silverstrip error. However, I seem to have better luck with www.mysite.com/db/build/?flush=1

    But not much better.

    Now I am prompted for a security login. I am already supposed to have admin credentials.

    5387 Views
Page: 1 2
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.