Active
Project:
Blog Information
Version:
5.x-2.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 May 2007 at 12:14 UTC
Updated:
18 Mar 2010 at 20:24 UTC
I am trying to use Bloginfo on a church's website. If you look at The Rector's Pen blog, it should say "The Rector's Pen" rather than "tim's blog" in the title. But it doesn't. I've followed the "Readme" but to no avail. Please assist.
Thanks in advance.
Comments
Comment #1
mfer commentedI'm not sure you understand what the module does. It creates a block that you have to enable and place in a region. It doesn't replace the title that is in the page.tpl.php as $title.
If you want to do the replacement with the bloginfo module to do your title and description on the blog page do this. Enable the bloginfo module. Place a region just above your content section. It may be the header region, one of the sidebar regions you aren't using, or you can create a new one. Place the block in that region at /admin/build/block.
Then, in your page.tpl.php file replace
print $title;with:if (arg(0) != 'blog' || $node->type != 'blog') { print $title; }This will have the title not show up on blog nodes and blog listings.
Is this what you are looking for?
Comment #2
mfer commentedoops.. I meant for the second one to be:
Comment #3
zanlus commentedI see what you are suggesting, but that isn't what I want to do. The result of your suggestion is that the title from blogs are subsequently removed.
The description of bloginfo says, "The bloginfo module adds a blog title and description to your blogs." If I have correctly understood your response (which I greatly appreciate, by the way), the module doesn't add a blog title to the blog. Rather, it produces a block that represents the blog with a title of your choosing. However, Drupal continues to recognize the blog as "$user's blog" (in this case "tim's blog"). If you have any suggestions about how to change that, I would appreciate your advice.
Many thanks for your help and I'm sorry that I didn't understand more completely what the module is capable of doing.
Sincerely,
Ross
Comment #4
mfer commentedok, the bloginfo doesn't do quite what you are looking for.
There are a couple ways you can get what you are looking for. It depends on if you want to separate your business logic from your presentation. How many different pages do you want this change to appear on? Just the one blog or several pages?
Comment #5
mfer commentedMarking as closed. If this is not taken care of please re-open the issue
Comment #6
udvranto commentedYou code does not work for me. When I click "My Blog" the $title is not replaced. I am using pathauto module. Does that affect? In Andreas 01 template I have this line
The drupal_set_message prints inconsistent info for arg(0), sometimes it is 'blog', sometimes it is 'node'.
Comment #7
mfer commentedThe code above does not replace the title. It conditionally removes/displays it.
This says that if arg(0) is 'blog' than don't display the title. You'll find this with urls like /blog/1 or /blog/2. This is not affected by URL aliasing.
Second, it checks the node type that's being displayed. If the node type is 'blog' than it doesn't show the title. In the second case I am not checking to see what arg(0) is but what type of node something is if there is a node loaded.
in all other cases it does. This should work in any phptemplate theme code in your page.tpl.php file.
The intent of this is to turn off the title so you can use the bloginfo module in that titles place
Comment #8
udvranto commentedFor those who wants to replace the blog title "%users Blog" to bloginfo title here is how you do it:
This is for andreas01 template
template.php
========
page.tpl.php
=======
Change the following :
TO:
Comment #9
mfer commentedComment #10
mr.j commentedInstead of inserting special content regions, and adding blocks, and modifying a template I prefer to do it this way. In your template.php, edit _php_template_variables function like so:
This will overwrite the title on blog pages without any other changes, and provide you with an extra variable 'blogdesc' which you can use in your page template if you want.
It would be better if the module supplied these variables via a function - instead I had to copy the code out of the bloginfo_block() function.
Comment #11
mr.j commentedSorry I cannot edit the previous post. It has a bug in that it replaces the title of all blog entries within the blog, as well as the main blog page. Instead replace that middle section between my marked comments with this code and it will only replace the title on the main blog page (ie /blogs/user):
Comment #12
level02 commentedthat code worked! and it would be perfect for tim's blog!
now how do I modify the teaser $links to read '($bloginfo->title)' instead of 'User's Blog'...
could it be a simple template.php function?
Comment #13
sam mooreHere's how you change the page title (in the HTML
<head>section) so it'll show up as I think you want in the title bar of your browser:drupal_set_title($title = t("@name's blog", array('@name' => $account->name)));Obviously you can remove the commented asterisks, but I find them helpful later when I can't remember what I hacked :-)
Also I left the original code in place, just commented it out.
Comment #14
sam mooreHere's a hack for the links at the bottom of each blog entry (currently these will say "
<username>'s blog"; you probably want them to say "<Blogtitle>").The line with "Read the latest entries..." fixes the tooltip.
Now, for some reason, this only works when you're logged in - unauthenticated users still get "
<Username>'s blog".Maybe I'll figure that out later...
Comment #15
sam mooreSorry, failed to close a
<code>tag in the last post - write back if you can't figure it out.Comment #16
level02 commentedWorks! On a local setup all users can see blogtitle using the above code and the page is also titled blogtitle thanks to post #13. Now it would be nice to render the
& #039;'s as apostrophes... I'm sure i can find how to do that somewhere. (ex. blogtitle =The Dog's Breakfastrenders:The Dog& #039;s Breakfast.) Also looking at the code and with the template function, I'm on my way to figuring this out.thanks
Comment #17
level02 commentedI used
filter_xssinstead ofcheck_plainto fix the apostrophes after finding this page, and it seems to work.Comment #18
mr.andrey commentedHere is a simple solution, add this to the bottom of your node.tpl.php
This is simple, because $node->name (author's name) is available to the teaser listings of nodes, so a simple call to drupal_set_title can fix this.
Note the "if" statement: with my setup, this is all I need, since I list all my blogs under /blogs with pathauto, but if you list your blogs under /blog, you may want to do another check so this doesn't override all of the titles for your blogs as well.
Best,
Andrey.
Comment #19
goose2000 commentedOh this is a very mis-leading module, in name and description of what it does. I'm with the 1st guy.
"I am trying to use Bloginfo on a church's website. If you look at The Rector's Pen blog, it should say "The Rector's Pen" rather than "tim's blog" in the title. But it doesn't. I've followed the "Readme" but to no avail. Please assist."
Comment #20
darumaki commentedWhen I try this code above all it does is remove the user's blog link it doesn't replace anything that I can tell or am I missing something
Comment #21
mfer commentedWhat is it you are trying to do with this module?
Comment #22
drein commentedok... the only problem is what is best solution?
I'm a bit confusing, I see 3 or 4 manners to display title page of bloginfo, but don't you think that the best thing is to patch the module bloginfo itself?
ok I' not able to make this, but I think that it should be better patch bloginfo rather than the core blog module.
Also unofficial patch are appreciated.
thanks.
Comment #23
Delta Bridges commentedAny follow up on this?
Thanks,
Expat9
Comment #24
mr.andrey commentedHello there,
Just to follow up on #18. In order for that solution to work, you need to have pathauto installed and have it rewrite users' blogs to /blog/ or /blog/.
(arg(0) == 'blog') looks in the url for the first argument, so for example in site.com/blog/babushka, first argument arg(0) is "blog", second argument arg(1) is "babushka".
You can change the names, but it's important for user's blog and the actual blog entry to have different art(0).
I've not looked into this in a while, the tweak seemed to fix the problem and I haven't heard about it having problems from our members since.
All the Best,
Andrey.
Comment #25
Delta Bridges commentedThanks for the feedback :)
I will try it out and report here.
FYI, I just read an interesting discussion about removing Blog from core:
http://drupal.org/node/233301
Expat9
Comment #26
NNois commentedHello,
I've followed this tread, it work just gread ! only a missing thing is the pathauto URL...
is it possible to use the userblog title (from bloginfo module) in pathauto ?
Comment #27
markwa commentedAll I wanted to do was, for example, remove ...'s blog... from My Opinions's blog, so that the blog title would be displays as simply My Opinions. I don't have any problem asking my bloggers to use their blog title as there logon username. But it was annoying that the ...'s blog... showed up in the title.
The fix was easy. In the theme subidrectory, replace:
<h1 class="title"><?php print $title ?></h1>with:
Comment #28
kmadel commentedIn 6.4 the following template.php function works to replace the blog listing and individual blog page titles as well as the the head page title:
/**
* Override or insert PHPTemplate variables into the page templates.
*
* @param $vars
* A sequential array of variables to pass to the theme template.
* @param $hook
* The name of the theme function being called ("page" in this case.)
*/
function themename_preprocess_page(&$vars, $hook) {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
}
if (((arg(0) == 'blog' && is_numeric(arg(1))) || $node->type == 'blog')) {
if (arg(0) == 'blog') {
$authorid = arg(1);
} else if ($node->type == 'blog') {
$authorid = $node->uid;
}
$thisUser = user_load(array('uid' => $authorid));
$title = $thisUser->profile_first_name .' '.$thisUser->profile_last_name.' - '.$thisUser->profile_position;
$vars['title'] = $title;
$vars['head_title'] = $title;
}
}
Comment #29
vikingew commentedOk just reaching out check if someone still use this? It's been a long time I know, but I've been to heaven and back, no kidding. I can tell they have no computers there...