By rebekahford on
Hi
I have been given a client's Drupal theme which was created using Taxonomy and Views extensively.
What do I or the editor/admin need to do in Drupal to create bespoke classes or Ids for the titles, and nodes, that I can hook into as i wish to cluster the content and change the colours of the text and borders dependent on the taxonomy term provided? I am very experienced with CSS but not so much with Drupal's anatomy.
In other words can i append taxonomy_term as a variable to the class="node" and if so where from??
The outputted content is as follows for the content area:
<!-- begin content -->
<div class="node">
<h2 class="title"><a href="/drupal-staging/node/65">An Example Resource to Test Latest Resources Block</a></h2>
<div class="content">
<p>This is an example resource to test the resources block.</p>
</div>
<div class="links"><ul class="links inline"><li class="node_submitted first"><span>By <a href="/drupal-staging/user/1" title="View user profile.">admin</a> at 13/10/2008 - 08:35</span></li>
<li class="taxonomy_term_11"><a href="/drupal-staging/taxonomy/term/11" rel="tag" title="">Advertising</a></li>
<li class="comment_add"><a href="/drupal-staging/comment/reply/65#comment-form" title="Add a new comment to this page.">Add new comment</a></li>
</ul>
</div>
</div>
<div class="node">
<h2 class="title"><a href="/drupal-staging/node/64">A News Story</a></h2>
<div class="content">
<p>A test news article to discover if the creation of content will appear under the primary links menu</p>
</div>
<div class="links"><ul class="links inline"><li class="node_submitted first"><span>By <a href="/drupal-staging/user/1" title="View user profile.">admin</a> at 09/10/2008 - 10:59</span></li>
<li class="comment_add last"><a href="/drupal-staging/comment/reply/64#comment-form" title="Add a new comment to this page.">Add new comment</a></li>
</ul></div>
</div>
<!-- end content -->
Comments
You can append taxonomy_term
You can append taxonomy_term as a variable to the class="node".
That can be added in your node.tpl.php file for Garland type theme. For Chameleon type theme it can be added in your _node() function inside .theme file.
That needs to be done with php code. I've done it for Garland type( most common type of theme )
I have added the following code at the beggining of the file:
and then , when the file is printing the beggining of the node i have changed this line
for this line
That will print every taxonomy term related to the node as a css class, but this solution isn't very generic.
Anyway, I hope this will help you :)
Good Luck!