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.

General Questions /

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

Standalone pages (no using the default layout)


Reply


4 Posts   1437 Views

Avatar
IanP

Community Member, 5 Posts

20 December 2008 at 1:34am

Is it possible to create a standalone landing page that exists outside the main site? For example:

mysite.com/specialoffer

I can see that you can have pages not appear in the nav, but what I'm after is a page that has its own layout, nothing to do with the main site. Is there a simple way to achieve this, or am I better just uploading a static HTML page outside of SilverStripe?

Thanks for any insights.

Ian

Avatar
Liam

Community Member, 470 Posts

20 December 2008 at 8:35am

This can easily be done. What you'd want is a different template applied to this page. Have you read the tutorials on the use of include files and the layout folder? http://doc.silverstripe.com/doku.php?id=tutorials

Also take a look at this page for using renderWith() - http://doc.silverstripe.com/doku.php?id=templates&s=renderwith#calling_templates_from_php_code

Avatar
Nivanka

Community Member, 397 Posts

22 December 2008 at 3:09am

this is much easier to do in this way,

create a new page type, lets say StandalonePage.php, you will save this in the mysite/code/ folder

then what you have to do is just create your StandalonePage.ss (template) file in the mysite/templates/ folder

this is much easier to do, and it is less code too :)

Avatar
wildflower1975

Community Member, 59 Posts

15 March 2010 at 12:51pm

Make a new 'blank' controller in mysite/code/MyNewPage.php

class MyNewPage extends Controller {

function MyAction(){

// do stuff like get a dataobject that goes into the array to be rendered with your other template

return $this->customise(array())->renderWith('MyOtherPageTemplate','MyNewPage');
}
}

You'll need a mysite/templates/Layout/MyNewPage.ss with at least

$Content

in it.

You can then call your controller with http://localhost/silverstripe/MyNewPage/MyAction

HTH