4

Can someone give examples of using html not just a text string or logo graphic in the header for a site?

I ask because I'd like to use several web typography fonts to make a logp rather than a bitmap.

Update

Editing "editing WITHIN drupal" - would be nice, sorry to adjust question. Thanks for your answers so far.

3 Answers 3

4

Keep it simple. Just disable the logo in your theme settings and use a block in it's place. You can throw anything you want in there.

Just place a block using Drupal UI into the header region of your theme. No coding, no template files creating/hacking is needed.

0
2

This is an area I am just getting into so I do not have a complete answer. Are you looking to replace the site name text and style it?

The location of the text will vary according to the theme you are using. If you do not have firebug, I suggest you get it. It is an add-on that works with firefox browser and is essential for figuring out where things are. If you right click on the site name you can "inspect element" to find out what region name and css class is styling it.

You can place whatever text you want in a block and define a css type for styling it.

You can also do it programmatically. The text will have to be inserted in the php code file page.php.tpl. If you are not familiar yet, the php.tpl files actually construct the html code for a page when the request for the page is made. There are others, besides page but odds are that is where the code is. The style of the text can be redefined using css files.

1
  • "Are you looking to replace the site name text and style it?" - yes but styling individual words, so it would be best to have html capability. Firebug - yes I'll try that in Firefox thanks, I know of it, and Chrome has an inspect element feature built in. page.php.tpl - yes thanks - @tostinni gives further detail. Ideally it would be nice to be able to edit the html within drupal without editing the template files. Oct 25, 2011 at 8:17
2

All the action takes place in page.tpl.php, there you have the following variables

  • $logo: The path to the logo image, as defined in theme configuration.
  • $site_name: The name of the site, empty when display has been disabled in theme settings.
  • $site_slogan: The slogan of the site, empty when display has been disabled in theme settings.

which are used for rendering your site identity.
You can alter this tpl either directly (if it's your own theme) or by creating a subtheme.
There you put all your fancy HTML:

<div id="header">
  <div class="section clearfix">
    <!-- new HTML instead of Drupal's -->
  </div><!-- /.section -->
</div><!-- /#header -->
3
  • +1 thanks, I know this approach would work for me. Only disadvantage is that the HTML cannot be edited in Drupal as it involves editing the PHP. I'm likely to consider your answer as the one I will use but any thoughts on how to edit the html within drupal appreciated. Oct 25, 2011 at 8:13
  • 1
    @nicoz suggested the use of blocks, if your theme has a header region, then you can create an HTML block in Drupal and put it there. Which theme are you using ?
    – tostinni
    Oct 25, 2011 at 16:40
  • Yes, +1 @nicoz, I will accept his answer. Yours is enlightening and worthwhile to know as I want to learn about the template themeing. I am using minimal 1.22 theme on Drupal 7. Oct 25, 2011 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.