Hello.

What's the simplest way to accossiate css files with a disk based template. So that all content that is based on the template automatically links to the css files and no other content.

Thanks.

Comments

dman’s picture

What is a "disk based template" ?

Ferm-1’s picture

Its a php file that defines the template
"It is also possible to create disk-based template files. To do this, copy the contents of a contemplate textarea and paste it into a file called "node-nodetype-field.tpl.php" where nodetype is the content type and field is either "body", "teaser", or "rss". It is also possible to create a template called "node-nodetype.tpl.php" which will affect all cases, and "node.tpl.php" which will affect all node types."

dman’s picture

Oh.
Otherwise known as "template files" :-)

Well, the smartest way may be to place a call to

    drupal_add_css($directory .'/customview.css', 'theme');

In the top of your customview.tpl.php. I do that when adding css that's specific to custom blocks.

You still have to have the right selectors in the CSS, but the css won't be included unless the theme function was actually invoked on the page you are looking at.
drupal_add_css will ensure the call doesn't double-up or anything if called more than once.

Is that the answer you wanted?

Ferm-1’s picture

Perfect! Thank you very much.

Ok template file, I just used the term as written in the Content Templates Module help.

jrglasgow’s picture

Status: Active » Closed (fixed)