How to : replace blogs titles with blog-info
tsi - April 25, 2009 - 23:13
| Project: | Blog Information |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
this is not a support request, just sharing what I found using this module, If you are looking for a way to replace the blogs titles with the information from blog-info's block you can try this -
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.
