1 cslepage Jan 15, 2008 22:15
3 yabba Jan 16, 2008 00:03
Ahhh, hit admin > global settings > plugin install > related posts plugin settings .... tick "only be a widget" and press save :roll:
¥
*edit*
Scrap that, you may have just found a bug ...... bugger, there goes my day off :p
4 cslepage Jan 16, 2008 00:06
That's interesting information. I didn't actually locate it myself, I just installed the plugin. I can't find anything resembling "skin container" in my skin.
5 cslepage Apr 01, 2008 11:57
If I use this as a widget, which I am at www.comiclist.com, it works great, except that the related posts are limited to each individual blog. That is, if I use the same tag in a blog #1 post and a blog #2 post, and view blog #1, it does not relate any posts from blog #2, unless one of those two blogs features posts from both blogs.
Is there any way to remedy that?
6 yabba Apr 01, 2008 12:08
The limiting to "per blog" was a deliberate choice, but you should be able to make it "blogs wide" by changing this bit of code ( approx 164 )
// grab a list of all potential posts
$sql = 'SELECT DISTINCT post_ID
FROM T_items__item INNER JOIN T_postcats ON post_ID = postcat_post_ID INNER JOIN T_categories ON postcat_cat_ID = cat_ID
WHERE ( cat_blog_ID IN ( '.$blog_list.' ) )
AND ( ( post_ptyp_ID IS NULL
OR post_ptyp_ID NOT IN (1000) ) )
AND ( post_datestart <= \''.$time_limit.'\' )
AND ( post_status = \'published\' )';
to look like :
// grab a list of all potential posts
$sql = 'SELECT DISTINCT post_ID
FROM T_items__item WHERE ( post_ptyp_ID IS NULL
OR post_ptyp_ID NOT IN (1000) )
AND ( post_datestart <= \''.$time_limit.'\' )
AND ( post_status = \'published\' )';
ish :p
¥
7 cslepage Apr 01, 2008 12:45
Ourstanding! Thank you very much.
8 sims Apr 01, 2008 19:04
Cool, I had the same problem and now all is well.
I have a question/request,
Would it be 'easily possible' for me to add to the list of related posts links the tags which are common?
i.e
Instead of showing:
Related posts:
Post 1
Post 2
Post 3
Instead show it like this:
Related posts:
Post 1 (speed)
Post 2 (Cost)
Post 3 (Free)
Where the words in brackets () are the tags which make them related.
Preferably the tag words and brackets being smaller than the post title text.
I hope that makes sense.
9 yabba Apr 01, 2008 19:21
Probably
You should be able to compare the current posts tags and the related posts tags and then spit them out in a <span> with a classname or summat, so you can style them, but I have to wander off and score brownie points by making dinner for my better half.
If I remember when I next have chance to play I'll post some code ;)
¥
10 sims Apr 01, 2008 20:31
Cool, I look forward to it. I wouldn't have clue where to start.
11 yabba Apr 02, 2008 09:48
Crack open the plugin and make the following changes ( approx lines 218 -> 226 )
if( $related_posts = $DB->get_results( $sql ) )
{ // we have related posts
$original_tags = $Item->get_tags(); // grab the original posts tags
$output = $this->disp_params[ 'block_start' ]."\n".$this->disp_params[ 'title' ]."\n".$this->disp_params[ 'list_start' ];
foreach( $related_posts as $related_post )
{ // add a link to each related item
$related_item = $ItemCache->get_by_ID( $related_post->itag_itm_ID );
$related_tags = ' <span class="related_tags">( '.implode( ',', array_intersect( $original_tags, $related_item->get_tags() ) ).' )</span> ';
// grab the tags that this post shares with the original post
$output .= $this->disp_params[ 'line_start' ].'<a href="'.$related_item->get_permanent_url().'"
title=" '.$this->disp_params[ 'line_title' ].' ">'.$related_item->title.'</a>'.$related_tags.$this->disp_params[ 'line_end' ]."\n";
¥
12 topanga Apr 02, 2008 12:45
¥åßßå wrote:
The limiting to "per blog" was a deliberate choice, but you should be able to make it "blogs wide" by changing this bit of code ( approx 164 )
¥
Intersting to make it an option in the next relaese ;)
13 sims Apr 02, 2008 20:19
WOW, what can I say? works a treat but then you knew that didn't you?
I think you need to get the 'Blonde Bimbo' changed to 'Blonde Genius'
Now that's working, would it be at all possible to have the tags that are in brackets link to a search of all posts with that tag. Just like the tag cloud does?
Good work.
14 yabba Apr 02, 2008 20:43
adds a straw wrote:
Intersting to make it an option in the next relaese ;)
I'll add it to my todo list ;)
sims wrote:
WOW, what can I say? works a treat but then you knew that didn't you?
Yeah :roll:
sims wrote:
I think you need to get the 'Blonde Bimbo' changed to 'Blonde Genius'
I'll have a word and see if the admins will change it
and now that it works can you just..... wrote:
Now that's working, would it be at all possible to have the tags that are in brackets link to a search of all posts with that tag. Just like the tag cloud does?
Weirdly I had a feeling that was your next request :p yes it can, but ... due to your crap timing ( again ) ... I need to sod off whilst my better half serves up what she thinks is the winning entry in the brownie points contest ( not that she has a hope of winning, but I like to humour her ;) )
sims wrote:
Good work.
I do my best ... and when that fails I normally blame the core, or the aussies, cos they're nearly always to blame :|
Next chance I have to play I'll post some code ;)
¥
15 yabba Apr 03, 2008 09:30
Once again crack open the plugin and change the same section of code for this version :
if( $related_posts = $DB->get_results( $sql ) )
{ // we have related posts
$original_tags = $Item->get_tags(); // grab the original posts tags
$output = $this->disp_params[ 'block_start' ]."\n".$this->disp_params[ 'title' ]."\n".$this->disp_params[ 'list_start' ];
foreach( $related_posts as $related_post )
{ // add a link to each related item
$related_item = $ItemCache->get_by_ID( $related_post->itag_itm_ID );
$related_item->get_Blog(); // load the blog
$related_tags = array_intersect( $original_tags, $related_item->get_tags() );// grab the tags that this post shares with the original post
$related_links = array();
foreach( $related_tags as $related_tag )
{ // build the links
$related_links[] = '<a href="'.$related_item->Blog->gen_tag_url( $related_tag, '#' ).'">'.htmlspecialchars( $related_tag ).'</a>';
}
$cuzzins = ' <span class="related_tags">( '.implode( ',', $related_links ).' )</span>';
$output .= $this->disp_params[ 'line_start' ].'<a href="'.$related_item->get_permanent_url().'" title=" '.$this->disp_params[ 'line_title' ].' ">'.$related_item->title.'</a>'.$cuzzins.$this->disp_params[ 'line_end' ]."\n";
¥
16 sims Apr 04, 2008 20:17
wow, I can't quite work out how you did that but it certainly does work and I am eternally grateful. Thanks for all your hard work.
17 yabba Apr 04, 2008 20:25
No worries ;)
¥
18 laibcoms Apr 08, 2008 16:14
Thanks for the codes!
1) The "blogs wide" edit; and
2) the show related tags with link to tag-search
Question tho, how to make the "tag-search" also "blogs wide"? Or its not possible with how the b2evo tagging was coded?
Thanks again!
19 afwas Apr 08, 2008 16:19
That's been asked here: [url=http://forums.b2evolution.net/viewtopic.php?t=15101]How do you Make Tags Searchable[/url] without an answer though, the tags are stored completely different than the post (item).
Good luck
20 laibcoms Apr 08, 2008 16:30
Afwas wrote:
That's been asked here: [url=http://forums.b2evolution.net/viewtopic.php?t=15101]How do you Make Tags Searchable[/url] without an answer though, the tags are stored completely different than the post (item).
Good luck
No, I wasn't referring to making tags searchable (and it shouldn't be in the first place), but rather on expanding the previous suggestion (which was answered by Yabba) to make the link of the tags to point out to "blogs wide".
^_^
Using sims' sample:
Related posts:
Post 1 (speed) (link of tag: speed points to blog #1 only)
Post 2 (Cost) (link of tag: cost points to blog #5 only)
Post 3 (Free)
How about:
Post 1 (speed) (link of tag: speed will show all posts tagged with 'speed' from all blogs)
:D
21 yabba Apr 09, 2008 10:45
You *might* be able to create a "blog all" and then change the code I posted so that it always points to http://yourdomain/blog_all/?tag=foo
¥
22 laibcoms Apr 12, 2008 00:18
It works, though currently it's hard-coded, trying to find how to call the blog url....
I changed:
$related_links[] = '<a href="'.$Blog_url( $related_tag, '#' ).'">'.htmlspecialchars( $related_tag ).'</a>';
To:
$related_links[] = '<a href="http://gameshogun.ws/'.$related_tag.';">'.htmlspecialchars( $related_tag ).'</a>';
* My BlogAll is set as the main blog.
23 slamp Jan 13, 2009 21:56
Is related posts plugin still available and working for b2evolution 2.4.x ?
If yes, where can I find it ?
24 topanga Jan 13, 2009 22:08
slamp wrote:
Is related posts plugin still available and working for b2evolution 2.4.x ?
If yes, where can I find it ?
yes
and
yes
and
[url=http://waffleson.co.uk/2007/11/playing-with-relations]here[/url]
25 slamp Jan 14, 2009 11:36
Thanks a lot.
26 gcasanova Jan 18, 2009 03:41
I have a blog that is bilingual, how can I make the Title be in the proper language?
Blog A is in Spanish
Blog B is in English...
27 yabba Jan 18, 2009 07:53
What happens at the moment ?
A link to an example would be cool as the only languages on my blog are English and Nonsense ;)
¥
28 gcasanova Jan 18, 2009 13:04
Please, take a look at http://www.guillermocasanova.net (Spanish) and in the same blog look for Spenglish.info (pseudo-English).
You will see that I had to title the plugin as "Artículos Relacionados/Related Posts".
Also, I tried the plugin in another blog and the Related POsts are published BEFORE the "More" Tag... If you need an example I'll send you an image but right now I turned off the plugin in this last blog because of that.
29 yabba Jan 18, 2009 13:47
Ahhh, looks like it's another plugin that I need to sort translation strings out for :-S
I'd forgotten that it does that, luckily I've recently come up with a method that stops it happening :D
I'll do both updates at the same time and update BOPIT when they're done ;)
¥
30 gcasanova Jan 18, 2009 14:01
Thank You!
31 mrorph Jan 22, 2009 16:53
Greetings:
I just added the plugin to my [url=http://kitchen.mrorph.com/]blog[/url] and I really like it.
I didn't quite understand how to get the widget into a new container thus alleviating the repetitive output before and after the more tag.
Can someone assist?
32 slamp Jan 22, 2009 17:14
To add a container, edit your skin and add the code below
<?php
// Display container and contents:
skin_container( NT_('NEW CONTAINER FOR RELATED POSTS'), array(
// The following params will be used as defaults for widgets included in this container:
'block_start' => '<div class="$wi_class$">',
'block_end' => '</div>',
'block_display_title' => false,
'list_start' => '<ul>',
'list_end' => '</ul>',
'item_start' => '<li>',
'item_end' => '</li>',
) );
?>
For example, I add this code in _item_feedback.inc.php.
I display related posts before feedback: http://www.seven-passion.com/Lotuscars/lotus-evora-presentation
To use the widget in this new container, use the backoffice to edit properties for related posts plugin and check "widget only", then in widget page, add "AM Related Posts" to the container 'NEW CONTAINER FOR RELATED POSTS'
33 mrorph Jan 22, 2009 19:38
Thanks so much for the quick reply.
I have been working at this for several hours now and I cannot seem to get that new container to show up in the back office. I put the code that you gave me into _item_feedback.inc.php just to get started but alas, no container in the widgets tab to which to add the plugin.
What am I missing?
<!-- ===================== START OF FEEDBACK ===================== -->
<?php
// Display container and contents:
skin_container( NT_('NEW CONTAINER FOR RELATED POSTS'), array(
// The following params will be used as defaults for widgets included in this container:
'block_start' => '<div class="$wi_class$">',
'block_end' => '</div>',
'block_display_title' => false,
'list_start' => '<ul>',
'list_end' => '</ul>',
'item_start' => '<li>',
'item_end' => '</li>',
) );
// Default params:
$params = array_merge( array(
'disp_comments' => true,
'disp_comment_form' => true,
'disp_trackbacks' => true,
'disp_trackback_url' => true,
'disp_pingbacks' => true,
'before_section_title' => '<h3>',
'after_section_title' => '</h3>',
'comment_list_start' => "\n\n",
'comment_list_end' => "\n\n",
'comment_start' => '<div class="bComment">',
'comment_end' => '</div>',
'preview_start' => '<div class="bComment" id="comment_preview">',
'preview_end' => '</div>',
'comment_template' => '_item_comment.inc.php', // The template used for displaying individual comments (including preview)
'form_title_start' => '<h3>',
'form_title_end' => '</h3>',
), $params );
global $c, $tb, $pb;
34 mrorph Jan 22, 2009 20:13
I reloaded the skin and there was the container!
Thanks for you assistance slamp.
35 slamp May 09, 2009 09:37
Is it possible to add the related post plugin in each item of an RSS feed ?
36 yabba May 09, 2009 19:07
The short answer is "yes" ... the long answer would require me to go away and mutter over code for a tad ;)
¥
37 yabba May 10, 2009 09:23
Long answer :
Crack open /skins/_rss2/index.main.php and add the new bits ;)
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $Plugins, $tempskin;
$amRelPostsID = $Plugins->get_by_code('am_relPosts')->ID; // grab plugins ID
$tempskin = ''; // fool the plugin ;)
$params = array(
'max_related' => 10,
);
$Plugins->call_method( $amRelPostsID, 'SkinBeginHtmlHead', $params );
<?php
while( $Item = & mainlist_get_item() )
{ // For each blog post, do everything below up to the closing curly brace "}"
ob_start();
$Plugins->call_method( $amRelPostsID, 'SkinTag', $params ); // call related posts
$amRelatedPosts = ob_get_clean();
?>
echo $amRelatedPosts;
?>]]></content:encoded>
echo format_to_output( $amRelatedPosts, 'entityencoded' );
?></description>
The last 2 code blocks appear twice ( each ) in the file, make sure you do both changes ;)
¥
38 cslepage May 10, 2009 20:01
Fantastic!
Can the same code be used in the other RSS skins (atom, rss?) ?
39 yabba May 11, 2009 17:32
There's an easy way to find out :D
¥
40 cslepage May 11, 2009 18:07
You mean, try it myself? :) :)
Do you think I should back up my original files first? :)
41 edb May 11, 2009 18:20
Nah. Everything will be okay so don't worry about stuff like that. In fact, you can probably even turn off your monitor and use your keyboard backwards when you open files and copy paste stuff in.
On the other hand backing up won't hurt... ;)
42 cslepage May 12, 2009 05:01
Slamp, how is it working for you?
43 slamp May 13, 2009 22:15
I didn't have time to test it. I hope I will do it next weekend.
44 cslepage May 17, 2009 22:00
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request."
I will keep working with this, but yes, I'm glad I made a back up file.
45 react2media May 20, 2009 07:36
Can I change the font somewhere or is this hard coded? My knowledge of Flash is *very* limited.
I had no issues whatsoever installing the thing.
Thanks
Gimmi
Links Removed
Gimme, one more mindless post and your out of here. I've deleted your other post where you signed off as Regards Sani .
Don't bother returning until you know who you are
46 cslepage May 20, 2009 11:59
react2media, could you zip up the file and email it to comiclist at gmail dot com? That way I could see what I did wrong. Thank you!
47 john May 20, 2009 12:21
@cslepage
react2media has all the hallmarks of a hard working and underpaid spammer. He/she/it is talking about Flash.. this plugin is a lot of things but it sure ain't Flash.
He/she/it also posted another totally bonkers post which I deleted...
Be careful who you ask for help from :)
48 yabba May 20, 2009 12:45
cslepage wrote:
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request."
I will keep working with this, but yes, I'm glad I made a back up file.
As an aside, are you still getting a server error or is it all working for you now?
John wrote:
this plugin is a lot of things but it sure ain't Flash.
Did you just call my plugin boring? :O
¥
49 cslepage May 20, 2009 13:15
I am still getting the error. Most likely I have put your code in the wrong places.
50 john May 20, 2009 13:48
@ Yabba
Did you just call my plugin boring? :O
What! Boring! no way... they just work, like a Volvo :)
51 yabba May 20, 2009 17:05
cslepage wrote:
I am still getting the error. Most likely I have put your code in the wrong places.
If you'd like to pm me ftp details I could take a look?
John wrote:
like a Volvo :)
Now that's a tad low! :P
¥
52 tilqicom Jun 18, 2009 00:14
is it possible to use this plugin across blogs ? which i mean, if there are two related posts in two different blogs, would it be able to somehow display the one from the other blog in the list
53 sam2kb Jun 18, 2009 06:41
That's easy
Edit the following
function SkinBeginHtmlHead()
{
global $Blog, $timestamp_max, $DB;
// lets get all blogs for this blog if it's an aggregate blog
$blog_list = $Blog->get_setting( 'aggregate_coll_IDs' );
// add in this blog
$blog_list .= ( $blog_list ? ',' : '' ).$Blog->ID;
to
function SkinBeginHtmlHead()
{
global $Blog, $timestamp_max, $DB;
// Get all public blogs
$BlogCache = & get_Cache( 'BlogCache' );
$blog_array = $BlogCache->load_public( 'ID' );
// lets get all blogs for this blog if it's an aggregate blog
$blog_list = implode( ',', $blog_array );
// add in this blog
$blog_list .= ( $blog_list ? ',' : '' ).$Blog->ID;
54 lwest300 Jul 01, 2009 02:48
Currently the plugin is displaying the related posts in ascending order so older posts are being displayed first.
How can I change it so that it will only display the most recent related posts in descending order?
55 sam2kb Jul 01, 2009 02:58
Change "desc limit" to "asc limit" in the following code. Not tested...
// lets grab the ## most related posts
$sql = 'SELECT count(*) as post_tags_match, itag_itm_ID FROM T_items__itemtag
join ( T_items__tag ) on ( itag_tag_ID = tag_ID and itag_itm_ID in ( '.$this->post_ID_list.' )
and itag_tag_ID in ( '.$post_tag_list.' )
and not( itag_itm_id = '.$Item->ID.' ) )
group by itag_itm_ID order by post_tags_match desc limit '.$this->disp_params[ 'max_related' ];
56 yabba Jul 01, 2009 11:18
That'd show you least related posts first ;)
You'd need to do a fair amount of reworking to the sql to make that happen
¥
57 yabba Jul 01, 2009 22:03
Ohhh just had a thought ( bear with me, blondes aren't renowned for thoughts huh? ) ... you *may* be able to change the order by to :
order by post_tags_match desc, itag_item_ID desc
¥
58 lwest300 Jul 02, 2009 06:53
It works using the order below. Thank you
group by itag_itm_ID desc order by post_tags_match desc limit
This one gives an SQL error
order by post_tags_match desc, itag_item_ID desc
You do have to be careful where you locate the container for Related Posts...
My index.main.php with the Related Post Container called skin_container( NT_('Post bottom')