1 pipower Aug 13, 2006 05:10
3 pipower Aug 19, 2006 03:21
balupton wrote:
So what you want to do is:
$blog_for_this_cat_is = new Blog ( $blog_for_this_cat_is ); echo 'The blog`s name is: '.$blog_for_this_cat_is->name;
Thanks very much for the reply, and my apologies for the delay. (The notification of a reply was in my Spam box. I've fixed that now!)
When I do this, on the first post, the output I get is
The blog`s name is: New weblog
Every subsequent post has the output:
The blog`s name is:
The "new Blog" seems to be creating a new blog. What I'm looking for is information about the post's original blog (i.e., although the post is in blog #1, it really started out in blog #2 or #3, etc.).
Also, I think I failed to specify in my original question that I'm using version 0.9.0.12.
4 edb Aug 19, 2006 03:49
pipower wrote:
Also, I think I failed to specify in my original question that I'm using version 0.9.0.12.
That's plain old fashioned silly. Upgrade to at least 0.9.2 for so many reasons it's not worth going over.
As to your issue, dig on this: posts don't go in blogs - they go in cats and cats go in blogs. Now that you know this you can rework your efforts accordingly. Like first find the post's main cat ID then use that to find the associated blog's ID.
Hey try this. In the skin you use for your blog #1 add a bit of code to the post loop to tell you what b2evolution knows about the post.
<?php if( is_logged_in() ) {
echo '<pre>';
print_r( $Item );
echo '</pre>';
} ?>
For the 0.9.* generation (may it rest in peace) you might have to print_r( $this ) instead $Item. Either way, scroll through and see if you have a value for blog_ID. You probably do, and for way back in the good old days I'm suspecting it'll be $this->blog_ID that will give up the correct blog number for ya.
After that I guess you'll want to turn it into a link to the blog, but that's something I'm sure you'll have fun doing and sharing with the rest of us.
5 pipower Aug 19, 2006 04:03
EdB wrote:
That's plain old fashioned silly. Upgrade to at least 0.9.2 for so many reasons it's not worth going over.
Long story short: I have 0.9.0.12 because, at the time, I didn't realize I could install something newer than what cPanel gave me. So I wrote a ton of hacks, which work, and I have to launch on September 1. So I can't jeopardize it right now by installing a newer version and then trying to update my hacks. However, as soon as I launch, I'll work with a more-modern version on a parallel site and get everything ready.
EdB wrote:
As to your issue, dig on this: posts don't go in blogs - they go in cats and cats go in blogs. Now that you know this you can rework your efforts accordingly. Like first find the post's main cat ID then use that to find the associated blog's ID.
Hey try this. In the skin you use for your blog #1 add a bit of code to the post loop to tell you what b2evolution knows about the post.
<?php if( is_logged_in() ) { echo '<pre>'; print_r( $Item ); echo '</pre>'; } ?>
For the 0.9.* generation (may it rest in peace) you might have to print_r( $this ) instead $Item. Either way, scroll through and see if you have a value for blog_ID. You probably do, and for way back in the good old days I'm suspecting it'll be $this->blog_ID that will give up the correct blog number for ya.
Thanks! That was very informative. And, absolutely, I do get
[blog_ID] => 2
which is exactly the right blog.
So my question, then, is: how do I then get the title of the blog and its URL?
6 balupton Aug 19, 2006 05:00
http://doc.b2evolution.net/ -> whatever version of b2evo you want -> click 'evocore' up the top -> click the class you want down the left side -> look for the function or variable you need.
7 pipower Aug 19, 2006 18:49
Thanks to all for the pointers, suggestions,...
The following worked for me:
$authors_blog = Blog_get_by_ID( $Item->blog_ID);
echo '<div class="blog-title-link">';
echo
'<a href="',
$authors_blog->disp( 'blogurl', 'raw' ),
'" title="',
$authors_blog->disp( 'shortdesc', 'htmlbody' ),
'">',
$authors_blog->disp( 'name', 'htmlbody' ),
'</a>';
echo '</div>';
http://doc.b2evolution.net/HEAD/evocore/Blog.html#methodBlog
So what you want to do is: