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.

Template Questions

Add new Page Type in Behavior Tab?


Go to End
Reply

11 Posts   5388 Views

Avatar
Gina

31 December 2009 at 7:40am Community Member, 11 Posts

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

Avatar
baba-papa

1 January 2010 at 4:36am Community Member, 279 Posts

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

Avatar
zenmonkey

3 January 2010 at 9:18am Community Member, 528 Posts

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

Avatar
Gina

5 January 2010 at 7:15am Community Member, 11 Posts

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)

Avatar
Gina

5 January 2010 at 9:18am Community Member, 11 Posts

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!

Avatar
kurt

20 February 2010 at 3:49pm Community Member, 2 Posts

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.

Avatar
zenmonkey

23 February 2010 at 2:39am Community Member, 528 Posts

Is it a standard 404 error or Silverstripe Error?

Avatar
kurt

24 February 2010 at 5:29pm Community Member, 2 Posts

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.

Go to Top