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.

Template Questions /

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

Current best method for including print.css

Go to End

5 Posts   3664 Views

Samba Sam

Community Member, 85 Posts

23 October 2009 at 10:39pm


Looking through the archives, I came across a suggestion for appending a print.css to a template by adding the following to your Page_Controller -> init method:

Requirements::themedCSS("print.css", "print")

However in the default Page.php document. it says the following.
// Note: you should use SS template require tags inside your templates

Is there one for the current version of SS for print.css? What is the current best method for including a print.css?



Forum Moderator, 5523 Posts

24 October 2009 at 12:31am

That is still currently the best way. I don't think <% require %> in templates support media types (such as print yet)

Samba Sam

Community Member, 85 Posts

25 October 2009 at 8:52am

Hi Will,
Thanks for your quick response. But I can't seem to get your suggestion to work.

I added Requirements::themedCSS("print.css", "print") to Page.php, as in the following:

class Page_Controller extends ContentController {

public function init() {

Requirements::themedCSS("print.css", "print");

I refreshed the database, yet their is no linked print. css code in the head of the index file when I go to view the

I'm I missing something?



Forum Moderator, 5523 Posts

25 October 2009 at 10:54am

themedCSS will add the .css for you. Just try Requirements::themedCSS('print', 'print');

Martin D.

Community Member, 21 Posts

17 October 2013 at 7:05am

In case you are still wondering, the method looks like this:

Requirements::themedCSS('printstylesheet', null, 'print');