HI,
When showing the main-page of a user blog, I got the link called "weblogs" in the breadcrumbs. I don´t like how that weblogs-page (which shows the latest blog-posts of all users) is displayed and want to do an own view substituting this page.
I already tried to overwrite it, by:
- creating an alias from "/blog" to "/community/blogs.html"
- setting up the page-view with the same URL
Sadly it seems the standard blog-page overwrites the view url, not the opposite, so I still got the standard drupal-blogs-page at this url and not my view.
By the way: For Blog Posts, it isn´t a problem, I can just do a custom breadcrumb for them, but not for the main user-blog page.
For breadcrumbs, I already got this in my template.php (if it could only be done trough the template.php) :
<?php
function test_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
foreach($breadcrumb as $value) {
$crumbs .= ''.$value.' » ';
}
}
return $crumbs;
}
?>
Thanks for any help,
Marc
Comments
I was successful using rules...
I made it by using rules.
(Please note, that I´m using the german version, so I don´t know the exact english terms used by drupal)
The breadcrumbs of the posts inside the blog like "/user/1/blog/somepost.html" are set by custom breadcrumbs, and this rule did not cause conflicts with those settings (I feared there would be a conflict).
A long time I tried "If Path has alias" and put in the blog-path (in my case /user/[author:uid]/blog.html). Without any success and just as an act of despair, I tried the content type.
So happy I got rid of that breadcrumb without doing php-stuff in template.php, I don´t really understand.
Hope this will help someone in the same situation.
If I understand your question
If I understand your question correctly, I had a similar problem and this worked for me...
Change it to whatever you'd like at: "/admin/build/menu-customize/navigation."
Changing the link text in breadcrumbs isn't something I've thought about. "Blogs" works fine for me. It shouldn't be too difficult, however.
My first though would be to add a "phptemplate_breadcrumb($breadcrumb)" override to "template.tpl.php" and then use PHP's "str_replace" function to change the text to whatever you'd like it to read.
For example:
str_replace("Blogs","Custom Link Text","$breadcrumb",1)
Hope that helps.
YMMV
OK, I just HAD to give this a
OK, I just HAD to give this a try. This works for me:
If you want all occurrances of "Blogs" to be changed to "Custom Link Text" (or WHATEVER"), just remove the $count variable (it tells it to only replace the FIRST occurance).
Ooops -- Now the breadcrumb
Ooops -- Now the breadcrumb is "unclickable!"
You have to include the link:
The whole "$count" thing
The whole "$count" thing won't work after all. You'll need to use PHP's "preg_replace" function if you want to replace ONLY the first 1 (or 2 or 3 or whatever) instances of "Blogs." To replace them all, stick with "str_replace." PHP's "preg_replace" function is much slower than "str_replace."
Of course, if you're changing the link text from "Blogs" to something like: "My Site's Blogs" then you're obviously going to get into some trouble here, because you'll end up changing "My Site's Blogs" to: "my Site's My Site's Blogs" (Arghh!). Working on that.
Of course, if you're changing
Well that was easy enough (DOH!). Simply go back to using str_replace and forget the whole "count" thing.
Check to see if it's "Blogs" and not "My Site's Blogs" by including the delimiters (">>" -- or whatever you're using for delimiters) in the string to search for.
$breadcrumb=str_replace(">> Blogs",">> Custom Link Text",$breadcrumb);
OK. This risks getting pretty convoluted. I'll go away now.
B^/
Did you guys miss my second posting?
It was quite easy, since I understood, how to set up the rule correctly (or at least in this case correctly)
Thanks anyway for your efforts.
I guess I
I guess I misunderstood:
How does changing the breadcrumbs change what display you see (drupal default blogs page or your new view)? What happens now if someone go to the url: "www.YourSite.com/blog"?
Of course it´s still existing, but...
I think, I got rid of the last link to it. At least, I can´t find any link on my site, that points to /blog anymore... so it´s basically the same.
I never was troubled, that the url /blog is not available (for other content, than the standard "all-blogs-display"), I just didn´t want anyone, to go on this page (because it doubles with the view and I didn´t like the display), I just want to hide this page totally from users.
Even Search Engines won´t get the /blog-page, because nothing links on it. Where else should a link to this page be? I searched very hard, to get sure, I got rid of it.
Maybe, I didn´t notice another link, but I searched really hard for it. And in case someone puts in this url by hand, I will just redirect it to my connected Wordpress-Blog (blog.mypage.com) or the new blog-view-page.
I´m sure, this solution won´t work for every case, but in mine, I think, it worked.
And sorry, if I didn´t describe the problem clear enough.
Ahh, I see. You just want to
Ahh, I see. You just want to change the links pointing to the default Blogs page. In that case, your solution works very well indeed.
:-)
My experience has been that old "system links" (for lack of a better phrase) have a habit of popping up when and where I least expect them, as the site grows and changes. I'd rather fix a problem while I'm thinking of it than "mask" it and have it reappear in the future to bite me.
Anyway, I had fun playing with this. Maybe someone with special circumstances will find my bit of "mental masturbation" helpful some day.
8^S
PS: Speaking of search engines, you might want to exclude the default view from being indexed by adding it to your "robots.txt" file. Just to be safe.
Cheers.