How to : replace blogs title with blog-info

tsi - April 25, 2009 - 23:10
Project:Blog Information
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

What I did is to replace <?php print $title; ?>
with this on page-blog.tpl.php :

<?php
      $block
= module_invoke('bloginfo', 'block', 'view', 0);
              if (
$block['subject']) {
             
$output = "<div class=\"bloginfo-block\">\n";
             
$output .= "<div id=\"bloginfo-block-title\">".$block['subject']."</div>\n";
             
$output .= "<div class=\"content\">".$block['content']."</div>\n";
             
$output .= "</div>\n";
              print
$output;}
    else print
$title;
?>

On the user's blog page - this will give you the blog-info instead of the the normal title and the normal title if blog-info is empty.

and with this on page.tpl.php :

<?php if ($node->type == 'blog'): ?>
    <div id="blog-title">
   <?php
                    $block
= module_invoke('bloginfo', 'block', 'view', 0);
                      if (
$block['subject']) {
                       
$output = "<div class=\"bloginfo-block\">\n";
                       
$output .= "<div id=\"bloginfo-block-title\">".$block['subject']."</div>\n";
                       
$output .= "<div class=\"content\">".$block['content']."</div>\n";
                       
$output .= "</div>\n";
                        print
$output;}
             else print
t("@username's blog", array('@username' => $node->name))
          
?>

    </div>
<?php endif; ?>

Here you replace the title with the blog-info only if the node type is blog, you might want to give it an alternative (else) for nodes that are not blogs.

#1

tsi - April 25, 2009 - 23:17
Status:active» duplicate

ooops, tried to edit the original post.
marking as duplicate of http://drupal.org/node/445040
you can delete it if you want.

 
 

Drupal is a registered trademark of Dries Buytaert.