I think this is a simple question, but several hours in, I can't figure it out.

I'd like a specific block to have a different format for its title (not the titles of the articles within it which I have already tweaked with views templates).

One easy way seemed to be to edit the style output theme template to change the title h3 tags to h1 - but that doesn't make difference. The new template scans but I still get the title in h3.

Perhaps I could also adjust the css for the specific block. I tried this in style.css

#block-views-Article_Headers-block_10 .title {
background-color: yellow;
}

(just to see if I could affect the title - I don't really want a yellow background). But that didn't work either.

Suggestions gratefully received.

Comments

richardsmart’s picture

Hi,

What do you mean by the new template scans- are you sure that your changes are being used by Drupal? If not, make sure and flush the caches (Administer > Site Configuration > Performance) so that your changes are used. Firebug for Firefox is always a really useful tool to check how things on a page are themed, also a good idea to check out Devel.

Rich

timdp’s picture

Rich

When I said the template was scanned, I mean created an edited style output template for the view (a block), rescanned, and saw that the one I had created is now bold. the code is

<?php
// $Id: views-view-unformatted.tpl.php,v 1.6 2008/10/01 20:52:11 merlinofchaos Exp $
/**
 * @file views-view-unformatted.tpl.php
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
?>
<?php if (!empty($title)): ?>
  <h1><?php print $title; ?></h1>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>
  </div>
<?php endforeach; ?>

which I hoped would put an h1 around the block title.

I have used firebug all morning to try and figure it out, but I am not proficient enough for that to have given me enough help yet. I did incidentally clear the drupal and firefox caches.

lomo’s picture

You might find the Devel Themer (requires Devel) handy for troubleshooting your mods to a theme. Firefox plugins (or developer tools in Safari) can also help to better understand all the CSS that's applied to particular content on a page and view the "cascade"... there are a lot of options. I suspect you may not have identified the right style or may need to clear your caches(?).

See you at the Drupalcon!

timdp’s picture

FYI the page is question is here:
http://www.bloomgroup.com/content/reengineering-white-paper

I built the whole site - except for 30 hours of professional theming we paid for (to improve the looks) a few months ago. So I know as much about Drupal as as it took me to get this far. But I haven't yet got my head around theming other than some hacks to css and a creating a handful of customized views templates. I feel as though I have figured out nearly enough to make real theme edits, but it's still confusing.

Anyhow, the title I am trying to change to h1 (there are other options I'm sure, but this seems as though it should be an easy route, notwithstanding I'd have 2 x h1s on the page....) is

"Articles about Writing and Marketing White Papers",

about half-way down. I will look at Devel Themer, though I think the underlying problem here is my incomplete understanding of how theming works.

Thanks for your interest...

john.kenney’s picture

it's a little unclear what your goal is: to change the format/style of the text or to make it an h1, but i think styling is the primary issue and you are changing the heading tag to get that formatting straight away. and as a general rule for SEO purposes, you don't want 2 h1 tags on the same page (as you hint at).

to do via CSS should work with the CSS you posted above. i would try putting in the actual thing you want like font-size: xx% or whatever. then fiddle with it until it is the right size or color or whatever it is. possible do it as h3.title if it isn't taking. it should be completely straightforward.

do note that your style sheet is being cached (else it would just say the applicable file names - e.g., style.css). this could be what's causing you not to see new CSS changes right away. so you need to clear the cache via performance tab to make sure it is updated. if you still don't see updates, then you may also need to ensure browser cache is clearing as well.

and of course you are using firebug in firefox to assist in debugging, i hope.

good luck.

lomo’s picture

That said, you're right that it is a bit odd to have more than one "h1" on a page, but I guess it's either that or change the style used for the titles listed below since they are a larger point-size than your h3 header.

Theming can be a pain, though. I wish you the best of luck. In the meantime, I don't think I'd worry about it too much. If you want to learn more about Drupal theming, there are some good books, guides here, as well as Lullabot and Lynda.com trainings which I believe are supposed to be quite good.

Personally, I'm still a couple steps behind you; currently mostly happy with my theme. I'm sure before I bring my site online, though, I'll be struggling with some similar issues. :-/

See you at the Drupalcon!

timdp’s picture

Thank you all. That problem at least, solved. I went for a bike ride and when I got back it all seemed a lot simpler,with your help.

I was just trying to use h1 to get the format I wanted. In the end I figured out how to use firebug to tell me what css id to use (point and copy instead of try and deduce from first principles - which was way too complicated), found the css sheet the developer had used for all their tweeks (local.css), and formatted h3 just for that block in there. Cleared caches and done.

What I really want is a different theme for that part of the site, but I think I will settle for specific adjustments for now just to get the job done. By the time I have made all those, perhaps I'll be ready to separate out a theme - I already made a section.

Thanks again

lomo’s picture

Yeah, sometimes a bike ride (or a nap) can do wonders for sorting out technical issues. The mind can do some interesting things with unsolved problems while exercising or sleeping. Any kind of break away from the problem can often be helpful. :-)

See you at the Drupalcon!