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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Standalone pages (no using the default layout)


Go to End


4 Posts   1816 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, 400 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, 63 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