Jump to:

22979 Posts in 11815 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Standalone pages (no using the default layout)

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

Page: 1
Go to End
Author Topic: 1350 Views
  • IanP
    Avatar
    Community Member
    5 Posts

    Standalone pages (no using the default layout) Link to this post

    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

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Standalone pages (no using the default layout) Link to this post

    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

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Standalone pages (no using the default layout) Link to this post

    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

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Standalone pages (no using the default layout) Link to this post

    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

    1350 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.