Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49204

How to apply css only to a specific page/node?

$
0
0

How do I apply some css rules only to a specific page? I am scraping content from another part of the university site onto a panel for one of the librarians at work. Unfortunately there is a default css rule in the theme that is applying a top border to tables that I do not want to appear in this panel (yes, I know tables are evil for anything other than tabular data, but I don't have much control over what I am getting).

http://library.drake.edu/educ-virtual-library
(all of the grey bars in the central column are my issue)

I did a little bit of searching and I think I want to do something like :
-----------------------(code copied from a google search)
function mymodule_preprocess_node(&$variables) {
$node = $variables['node'];
if (!empty($node) && $node->nid == $the_specific_node_id) {
drupal_add_css(drupal_get_path('module', 'mymodule') . "/file.css", "module");
}
}

or
function mytheme_preprocess_node(&$variables) {
$node = $variables['node'];
if (!empty($node) && $node->nid == $the_specific_node_id) {
drupal_add_css(path_to_theme(). "/file.css", "theme");
}

}

Is writing a module or a fuction to dynamically insert another css file with rules to override the default rules the best way to go?

Do I just need to run a query on the node table and find the right nid to match my title and use something like the code above?

To have a better clue of what I am doing should I read up on theming in "using drupal", "pro drupal development" or some other book?

I have not had any time to really read up on drupal, would I be better off if I sat down and read all the the way through pro drupal, using drupal, or another book? Right now most of my concerns seem to be with css/theming and permissions. I also could use a basic, firm grounding in drupal.

Any suggestions would be much appreciated.

-Purcell


Viewing all articles
Browse latest Browse all 49204

Trending Articles