Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How to render $Content without any template?

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

Page: 1
Go to End
Author Topic: 1871 Views
  • Anatol
    Avatar
    126 Posts

    How to render $Content without any template? Link to this post

    Hi,

    I created a new page type PlainPage and I would like to just render the content of the TinyMCE editor. I added the template /themes/mytheme/templates/PlainPage.ss with a simple

    $Content

    However, this strips out any DOCTYPE, <html> and <header> tags - but that already happens through TinyMCE.

    Then I tried to add this to the PlainPage.ss code

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
    <head>
       <title>$Title</title>
       $MetaTags(false)
    </head>
    <body>
    $Content
    </body>
    </html>

    It would be OK for my purposes to have this simple code, but then Silverstripe always adds a

    <link rel="stylesheet" type="text/css" media="screen" href="http://etc ...


    before the closing </head> tag. This comes from the Page.php init() function with lines like

    Requirements::themedCSS("typography","screen");

    How can I tell Silverstripe NOT to add this CSS information to the new page type? (But I need it in other page types.)

    Cheers!
    Anatol

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: How to render $Content without any template? Link to this post

    function init() {
    parent::init();
    Requirements::clear();
    }

    Having that in PlainPage_Controller should get rid of all those CSS files.

  • Anatol
    Avatar
    126 Posts

    Re: How to render $Content without any template? Link to this post

    Brilliant! Thanks Simon!

    1871 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.