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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Change page template for User Defined Forms Module


Go to End


6 Posts   3619 Views

Avatar
ramshackle

Community Member, 22 Posts

11 May 2010 at 8:48pm

Hi there,

Fairly new to SS and using the User Defined Forms Module - all working ok but I need to use a new template to display the page containing the form - it seems to default to using the "Page.ss" template and I can't see where to change this to my newly created template (you have to select "User Defined Form" from page type in the CSS whereas this is where you would normally select your new page template).

Any help much appreciated.

Cheers

Avatar
Willr

Forum Moderator, 5523 Posts

11 May 2010 at 10:34pm

All page types will use Page.ss if no template for that class name is defined. In this case if you made a UserDefinedForm.ss file (and flushed the cache) it would be using that file instead of Page.

Avatar
gocreative

Community Member, 17 Posts

14 May 2010 at 12:10am

This makes sense and I've got it working, however what about in the case where I want to create a new page type? Say, a page which has two columns instead of the standard template with just one column.

Avatar
Willr

Forum Moderator, 5523 Posts

14 May 2010 at 8:54am

One way would be to subclass UserDefinedForm say class DualColumnUserDefinedForm extends UserDefinedForm { then have a DualColumnUserDefinedForm.ss template and use that. Would mean you have a pagetype for purely layout which isn't great but it'll work

Avatar
ramshackle

Community Member, 22 Posts

14 May 2010 at 10:17am

Thanks Willr,

Quite obvious really! But didn't think about it.. Works great now.

Oneilldesign - I just created UserDefinedForm.ss form the Page.ss template and added a new div within the 'Layout' div to create an extra column so this form page has a two column layout. Not sure if you mean you need the standard layout and an additional second
template though - I guess that is what Willr is talking about.

Cheers

Avatar
gocreative

Community Member, 17 Posts

14 May 2010 at 11:08am

Thanks for the replies. I guess what I was really asking was how to create a new page template (purely for design/layout purposes). But you've more or less answered that question - I would just extend the Page class rather than the UserDefinedForm class.

I'm new to SS (first install was yesterday) and just getting to know how it all comes together. Being primarily a designer rather than coder, I hope it's not too difficult to apply a different layout to each page on my site.