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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

How to render $Content without any template?


Go to End


3 Posts   2650 Views

Avatar
Anatol

126 Posts

17 April 2009 at 1:47pm

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" xml: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

Avatar
(deleted)

Community Member, 473 Posts

17 April 2009 at 2:19pm

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

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

Avatar
Anatol

126 Posts

17 April 2009 at 2:42pm

Brilliant! Thanks Simon!