..to a node. How do I do that? I added nodeStyles.css to the template file and it isn't working.

... ?
function atck_styles() {
$css = drupal_add_css(path_to_theme() .'/page-layout.css', 'theme', 'all');
$css = drupal_add_css();
unset($css['all']['module']['modules/node/node.css']);
unset($css['all']['module']['modules/system/defaults.css']);
unset($css['all']['module']['modules/user/user.css']);
unset($css['all']['theme']['themes/--pbmedia09/nodeStyles.css']);
return drupal_get_css($css);

I added this to page.tpl.php and tried it on node.tpl.php.

... ?

$styles = drupal_get_css(drupal_add_css(path_to_theme() . '/nodeStyles.css', 'theme', 'all', TRUE));

That didn't work either. I wish you could just add head content to nodes....

Comments

patbranch’s picture

bump...

patbranch’s picture

Third bump.

patbranch’s picture

Can someone please help? It shouldn't be this hard to link a stylesheet...

hferree’s picture

Hope this helps..It looks slightly different than what you were trying.

http://drupal.org/node/66122

// Repeat this line for every CSS file added.
drupal_add_css(path_to_theme() . '/example.css', 'theme', 'all', TRUE); 
// Reassemble the $styles snippet to include the new files.
$styles = drupal_get_css();
patbranch’s picture

Thanks for the reply. That would go on the template file, right? It's not linking...for some reason. Here's the site...you can see it's not in the source, http://mediabypb.com/drupal-5.7/main .

xhe’s picture

You may need to specify the hook, here is my code, hope it can help.

function  _phptemplate_variables($hook, $vars = array()) {
	
  switch($hook) {
    case 'page': 
    
      $css = drupal_add_css($vars['directory'] . '/layout.css', 'theme');
	  if (arg(0)!='admin' && arg(1)!='add' && arg(2)!='edit') {
	      unset($css['all']['module']['modules/system/system.css']);
		  unset($css['all']['module']['modules/system/defaults.css']);
		  unset($css['all']['module']['modules/aggregator/aggregator.css']);
		  unset($css['all']['module']['modules/node/node.css']);
		  unset($css['all']['module']['modules/poll/poll.css']);
		  unset($css['all']['module']['modules/user/user.css']);
		  unset($css['all']['module']['sites/all/modules/cck/content.css']);
		  unset($css['all']['module']['sites/all/modules/og/og.css']);
		  unset($css['all']['module']['sites/all/modules/cck/fieldgroup.css']);
		  unset($css['all']['module']['modules/forum/forum.css']);	 
		  unset($css['all']['module']['sites/all/modules/forumthread/forumthread.css']); 	  	
	  } else {
	  	  $css = drupal_add_css($vars['directory'] . '/adminstyle.css', 'theme');
	  	  unset($css['all']['theme']['sites/all/themes/custom/barlow/style.css']);	  	
	  }

	  $vars['styles'] = drupal_get_css($css);

patbranch’s picture

Thanks, but I still can't get it to work... I don't know anything about php or any programming for that matter.

patbranch’s picture

This shouldn't be so difficult... Maybe i'm just dumber than I thought at it? haha

patbranch’s picture

I found the css module which does just what I need, so I don't even need to link a whole stylesheet.

http://drupal.org/project/css

hferree’s picture

Congrat's. I love happy endings.

patbranch’s picture

Haha. That's the best module ever for me since the content is all different compared to a typical magazine/news/blog site.
http://mediabypb.com/drupal-5.7