21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1195 Views |
-
Standalone pages (no using the default layout)

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
-
Re: Standalone pages (no using the default layout)

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
-
Re: Standalone pages (no using the default layout)

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
-
Re: Standalone pages (no using the default layout)

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
| 1195 Views | ||
|
Page:
1
|
Go to Top |




