Recent Topics

[HACK]Isaac's _recent.php hack

Started by on Jun 05, 2004 – Contents updated: Jun 05, 2004

Jun 05, 2004 19:34    

In http://forums.b2evolution.net/viewtopic.php?p=5588#5190 Isaac offered up a 'recent posts in sidebar' and I just now got around to using it. I see when there are no posts in the blog you get a page killing error:

MySQL error!

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY comment_post_ID, comment_type' at line 3(Errno=1064)

Your query:
SELECT comment_post_ID, comment_type, COUNT(*) AS type_count FROM evo_comments WHERE comment_post_ID IN () GROUP BY comment_post_ID, comment_type

No biggie really - just put a post in each blog and be happy, but I figured Isaac might want to know. And maybe others trying this hack on a new installation.

Jun 05, 2004 22:13

seems as the script needs an update to 0.9.x

Jun 05, 2004 22:27

That's what I was afraid of but gave it a go anyway. I also see now where adding a blog# to the list greater than 9 changes it's behaviour in very odd ways. I told it to not display blog 2 since that's my linkblog, but if I ask it to include any blog above 9 in includes 2 as well. Funny thing is in both cases I tell it to exclude blog 8 and it says yeah sure no problem.

Ah well. It's too smart for me! I barely understand what I'm looking at in there so I plod along until something obvious falls from the sky and lands in my lap screaming TYPE ME YOU IDIOT! Or I wait for another release... :D

Jun 09, 2004 23:11

I've been working on this is Isaac this afternoon, so here's a newer version of _recent.php. This may or may not fix the problems listed here, the main objective was to make the template tags compatible with 0.9.0.x, and to fix a couple of issues when displaying the comments:

<?php
	/*
	 * This is the template that displays the links to the recent posts
	 *
	 * This file is not meant to be called directly.
	 * It is meant to be called by an include in the _main.php template.
	 */
	if(substr(basename($_SERVER['SCRIPT_FILENAME']),0,1)=='_')
		die("Please, do not access this page directly.");

//text to show at the beginning of the recent posts list
if(!isset($recent_before_all)) $recent_before_all = '<h3>'.T_('Recent Posts').'</h3><ul>';

//text to show after the recent posts list
if(!isset($recent_after_all)) $recent_after_all = '</ul>';

//text to show before each item
if(!isset($recent_before_each)) $recent_before_each = '<li>';

//text to show after each item
if(!isset($recent_after_each)) $recent_after_each = '</li>';



//blogs to show in "recent posts"
if(!isset($recent_blogs)) $recent_blogs = '1';
//NOTE: If you set the $recent_blogs to 1, and select the categories that you want
// to show, then the "recent" links will be ordered by date, most recent first.
//If you select some blogs, however, you can sort them by blog first, then date.



//set to 1 to show the blog title/link on the recent posts
//I recommend not having this set if you're only use blog #1 for "recent posts"
if(!isset($recent_show_blogname)) $recent_show_blogname = '0';
if(!isset($recent_before_blogname)) $recent_before_blogname = '<li>';
if(!isset($recent_after_blogname)) $recent_after_blogname = '<ul>';
if(!isset($recent_after_bloggroup)) $recent_after_bloggroup = '</ul></li>';


//show the number of comments for each "recent" entry.
if(!isset($recent_ShowCommentNumber)) $recent_ShowCommentNumber = 1;

//show the date of each post
if(!isset($recent_showdate)) $recent_showdate=0;
if(!isset($recent_date_fmt)) $recent_date_fmt='d/m';


//max number of posts for each blog in the summary
if(!isset($numposts)) $numposts = 10;
//categories to show in "recent posts"
if(!isset($recent_cat)) $recent_cat ='exclude blogroll'; //keep out the blogroll blog, whatever it may be
//Some other options:
//if(!isset($recent_cat)) $recent_cat = '1 2 3'; //NO ENDING SPACE!
//if(!isset($recent_cat)) $recent_cat = ''; //show everything in recent posts
//TODO: add $recent_cat = 'exclude n'; to exclude posts in blog #n


//THE FOLLOWING ITEMS SET THE DATE RANGE
//THIS IS TRICKY, SO *PLEASE* READ THIS IF YOU'RE GOING TO PLAY WITH IT
// all posts from $recent_fromdate to $recent_todate will be shown
// You can set this up in the following ways:
//  1. Set both of them to some date, like "01/01/2004" and "01/31/2004" and you'll show all the posts
//     in a fixed date range.
//  2. Set ONE of them, and also set $recent_daterange.
//     If you do this, then the script will set the appropriate "from" and "to" dates.
//     For example, set $recent_fromdate to "January 1, 2004" and set $recent_daterange to "1 months",
//     and you'll get posts starting at 1/1/4 and going for one month.
//     You could also get the same effect by leaving $recent_fromdate unset, and setting $recent_todate
//     to "1/31/04", and having the $recent_daterange set to '-1 months'.
// **Use a NEGATIVE $recent_daterange if you're specifying the $recent_todate**  For example '-2 years'
// **Use a POSITIVE $recent_daterange if you're specifying the $recent_fromdate** For example '1 years'
//  The script will understand "now" as a valid argument for either the $recent_todate or $recent_fromdate
//  If you screw it up too bad, it'll just start at the current date and go back 1 month.
// I've included some examples for you.  Have fun.
//  --Isaac Z. Schlueter http://isaac.beigetower.org

if (!isset($recent_todate)) $recent_todate='now'; //show posts UP TO the current time.
//if (!isset($recent_todate)) $recent_todate='January 1, 2004'; //show posts through 1/1/2004.
//if (!isset($recent_fromdate)) $recent_fromdate = "01/01/05 23:44:21"; //show posts starting at this date/time
//only set ONE of the "to" and "from" if you're using a range, or the range is moot
if(!isset($recent_daterange) ) $recent_daterange = '-1 months';


// Do this to use this as a generic evoSkin template file:
// 1. Save this entire file to your skins directory
// 2. Copy this file into a particular skin folder, like $blogurl/skins/originalb2/
// 3. In $blogurl/skins/skinname/_recent.php, uncomment the next line:

// 	require get_path('skins').'/_recent.php';

// 4. In $blogurl/skins/skinname/_recent.php, customize all the things above this point
// 5. In $blogurl/skins/skinname/_recent.php, delete everything below these instructions.
// 6. Somewhere in $blogurl/skins/skinname/_main.php, add this line:

//  require(dirname(__FILE__).'/_recent.php');

// 7. Go through and delete all my stupid comments once you get the hang of it.

// ----------------STOP CUSTOMIZING UNLESS YOU KNOW WHAT YOURE DOING------------------

//dirty tricks...
$savedblog=$blog;

if ( $recent_cat == 'exclude blogroll') {
	$recent_cat = '';
	if (isset($blogroll_blog) ) {
		//echo "<code>$blogroll_blog</code>";
		$nobr_sql = " SELECT * FROM $tablecategories WHERE cat_blog_id <> $blogroll_blog";
//		echo "<code>$request</code>";
		$querycount++;
		$nobr_result = mysql_query($nobr_sql) or mysql_oops($nobr_sql);
		if ($row = mysql_fetch_object($nobr_result)) {
			$recent_cat = $row->cat_ID;
			while ($row = mysql_fetch_object($nobr_result))
				$recent_cat .= ' ' . $row->cat_ID;
		}
		//echo "<code>recent_cat=$recent_cat</code>";
	}
}


//set the $recent_timestamp_min and max from $recent_fromdate, $recent_todate, and $recent_daterange

//echo "<br /><code>$recent_fromdate</code>";
//echo "<br /><code>$recent_daterange</code>";
//echo "<br /><code>$recent_todate</code>";
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";
//echo "<br /><code>".date('H:i:s Y-m-d',strtotime($recent_todate.$recent_daterange))."</code>";
if(!isset($recent_todate)) {
	if (!isset($recent_daterange) || !isset($recent_fromdate) || (strtotime($recent_fromdate . ' ' . $recent_daterange) == -1))
		$recent_timestamp_max = strtotime("now");
	else
		$recent_timestamp_max = strtotime($recent_fromdate . ' ' . $recent_daterange);
} elseif(strtotime($recent_todate) != -1)
	$recent_timestamp_max = strtotime($recent_todate);
else
	$recent_timestamp_max = strtotime("now");
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";

if(!isset($recent_fromdate)) {
	if (!isset($recent_daterange) || (strtotime($recent_todate . ' ' . $recent_daterange) == -1))
		$recent_timestamp_min = strtotime($recent_todate . " -1 month");
	else
		$recent_timestamp_min = strtotime($recent_todate . ' ' . $recent_daterange);
} elseif(strtotime($recent_fromdate) != -1)
	$recent_timestamp_min = strtotime($recent_fromdate);
else
	$recent_timestamp_min = strtotime("now -1 month");
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";



//start displaying
echo $recent_before_all;

for( $b=blog_list_start('stub');
		$b!=false;
		$b=blog_list_next('stub') ) {
	if( false == stristr($recent_blogs,$b) ) continue;
	$BlogBList = new ItemList( 
		$b, 
		'', //	$show_statuses = array(),					
		'',	// Specific post number to display
		'', // YearMonth(Day) to display
		'', // Week number
		$recent_cat, // List of cats to restrict to
		'', // Array of cats to restrict to
		$author, // List of authors to restrict to
		'DESC', // ASC or DESC
		'', // list of fields to order by
		'',	//# of posts to display on the page
		'',	// List page number in paged display
		'',//$numposts - $MAXPERPAGE, // Start results at this position
		'',//$numposts - 1, // End results at this position
		'',	// Search string
		'',	// Search for sentence or for words
		'', // Require exact match of title or contents
		'',	// Is this preview
		$numposts, //$default_posts_per_page 
		'paged', //$init_what_to_show
		$recent_timestamp_min,	// Do not show posts before this timestamp
		$recent_timestamp_max  );	// Do not show posts after this timestamp
		
	
	$blog=$b;
	if($recent_show_blogname) {
		echo $recent_before_blogname;
		echo '<a href="';
		blog_list_iteminfo('blogurl', 'raw');
		echo '" title="';
		blog_list_iteminfo( 'shortdesc', 'htmlattr'); 
		echo '">';
		blog_list_iteminfo( 'name', 'htmlbody');
		echo '</a>';
		echo $recent_after_blogname;
	}
	for( ;$BItem = $BlogBList->get_item();) {
		echo $recent_before_each;
		if($recent_showdate) { the_time( $recent_date_fmt ); ?> - <?php }
		echo '<a href="';
		$BItem->Permalink();
		echo '">';
		$BItem->title('','', false);
		echo '</a>';
		if($recent_ShowCommentNumber) echo '&nbsp;'; comments_number('(0)','(1)','(%d)');
		echo $recent_after_each;
	}
	if($recent_show_blogname) {
		echo $recent_after_bloggroup;
	}
	

} 
echo $recent_after_all;

$blog=$savedblog; //recover from the dirty trick
?>

Jun 09, 2004 23:34

Thanks Graham! I'll check it out later because I want my next installation to use this feature, but it'll have to be a come-back thing. I'm kinda busy rewriting the installer to release the blog the way I want and my brain gets vapor locked pretty easy when it tries to take on more b2evo than it can handle...which isn't much.

EDIT: Sneak preview for those into it. http://rgsapilots.org/allblogs.php is different. The main page displays a reasonably static view comprised of the long description a by-blog html page and the notes field, with categories listed in the side bar and a "open blog" link at the bottom. I wanted to use the _recent hack instead of 'open blog' but since it didn't want to behave... Once I get the club released I figure on undoing all the very custom hacks and zipping up the skin for ya.

Jun 10, 2004 00:43

Good news and bad: it works :D but not with blogs over 9 :( . Blogs 10 and up give you blog 1's thing of listing all posts. I stopped at 18, so I can't say what 20 will do...

Jun 10, 2004 01:38

Ah! I'm using "stristr" to check the list of which blogs to use. Since "stristr" will tell you (correctly) that "1" is in "10," there's the error. That should be changed to explode the list to an array, and then check the array for matches.

Jul 09, 2004 14:42

Here is an updated version that deals with a couple of issues, particuarly problems when showing the recent comments page or the stats (although not the blogs over 10 yet):

<?php
	/*
	 * This is the template that displays the links to the recent posts
	 *
	 * This file is not meant to be called directly.
	 * It is meant to be called by an include in the _main.php template.
	 */
	if(substr(basename($_SERVER['SCRIPT_FILENAME']),0,1)=='_')
		die("Please, do not access this page directly.");

//text to show at the beginning of the recent posts list
if(!isset($recent_before_all)) $recent_before_all = '<h3>'.T_('Recent Posts').'</h3><ul>';

//text to show after the recent posts list
if(!isset($recent_after_all)) $recent_after_all = '</ul>';

//text to show before each item
if(!isset($recent_before_each)) $recent_before_each = '<li>';

//text to show after each item
if(!isset($recent_after_each)) $recent_after_each = '</li>';



//blogs to show in "recent posts"
if(!isset($recent_blogs)) $recent_blogs = '2';
//NOTE: If you set the $recent_blogs to 1, and select the categories that you want
// to show, then the "recent" links will be ordered by date, most recent first.
//If you select some blogs, however, you can sort them by blog first, then date.



//set to 1 to show the blog title/link on the recent posts
//I recommend not having this set if you're only use blog #1 for "recent posts"
if(!isset($recent_show_blogname)) $recent_show_blogname = '0';
if(!isset($recent_before_blogname)) $recent_before_blogname = '<li>';
if(!isset($recent_after_blogname)) $recent_after_blogname = '<ul>';
if(!isset($recent_after_bloggroup)) $recent_after_bloggroup = '</ul></li>';


//show the number of comments for each "recent" entry.
if(!isset($recent_ShowCommentNumber)) $recent_ShowCommentNumber = 1;

//show the date of each post
if(!isset($recent_showdate)) $recent_showdate=0;
if(!isset($recent_date_fmt)) $recent_date_fmt='d/m';


//max number of posts for each blog in the summary
if(!isset($numposts)) $numposts = 10;
//categories to show in "recent posts"
if(!isset($recent_cat)) $recent_cat =''; //keep out the blogroll blog, whatever it may be
//Some other options:
//if(!isset($recent_cat)) $recent_cat = '1 2 3'; //NO ENDING SPACE!
//if(!isset($recent_cat)) $recent_cat = ''; //show everything in recent posts
//TODO: add $recent_cat = 'exclude n'; to exclude posts in blog #n


//THE FOLLOWING ITEMS SET THE DATE RANGE
//THIS IS TRICKY, SO *PLEASE* READ THIS IF YOU'RE GOING TO PLAY WITH IT
// all posts from $recent_fromdate to $recent_todate will be shown
// You can set this up in the following ways:
//  1. Set both of them to some date, like "01/01/2004" and "01/31/2004" and you'll show all the posts
//     in a fixed date range.
//  2. Set ONE of them, and also set $recent_daterange.
//     If you do this, then the script will set the appropriate "from" and "to" dates.
//     For example, set $recent_fromdate to "January 1, 2004" and set $recent_daterange to "1 months",
//     and you'll get posts starting at 1/1/4 and going for one month.
//     You could also get the same effect by leaving $recent_fromdate unset, and setting $recent_todate
//     to "1/31/04", and having the $recent_daterange set to '-1 months'.
// **Use a NEGATIVE $recent_daterange if you're specifying the $recent_todate**  For example '-2 years'
// **Use a POSITIVE $recent_daterange if you're specifying the $recent_fromdate** For example '1 years'
//  The script will understand "now" as a valid argument for either the $recent_todate or $recent_fromdate
//  If you screw it up too bad, it'll just start at the current date and go back 1 month.
// I've included some examples for you.  Have fun.
//  --Isaac Z. Schlueter http://isaac.beigetower.org

if (!isset($recent_todate)) $recent_todate='now'; //show posts UP TO the current time.
//if (!isset($recent_todate)) $recent_todate='January 1, 2004'; //show posts through 1/1/2004.
//if (!isset($recent_fromdate)) $recent_fromdate = "01/01/05 23:44:21"; //show posts starting at this date/time
//only set ONE of the "to" and "from" if you're using a range, or the range is moot
if(!isset($recent_daterange) ) $recent_daterange = '-1 months';


// Do this to use this as a generic evoSkin template file:
// 1. Save this entire file to your skins directory
// 2. Copy this file into a particular skin folder, like $blogurl/skins/originalb2/
// 3. In $blogurl/skins/skinname/_recent.php, uncomment the next line:

// 	require get_path('skins').'/_recent.php';

// 4. In $blogurl/skins/skinname/_recent.php, customize all the things above this point
// 5. In $blogurl/skins/skinname/_recent.php, delete everything below these instructions.
// 6. Somewhere in $blogurl/skins/skinname/_main.php, add this line:

//  require(dirname(__FILE__).'/_recent.php');

// 7. Go through and delete all my stupid comments once you get the hang of it.

// ----------------STOP CUSTOMIZING UNLESS YOU KNOW WHAT YOURE DOING------------------

//dirty tricks...
$savedblog=$blog;

if ( $recent_cat == 'exclude linkblog') {
	$recent_cat = '';
	if (isset($blogroll_blog) ) {
		//echo "<code>$blogroll_blog</code>";
		$nobr_sql = " SELECT * FROM $tablecategories WHERE cat_blog_id <> $linkblog_blog";
//		echo "<code>$request</code>";
		$querycount++;
		$nobr_result = mysql_query($nobr_sql) or mysql_oops($nobr_sql);
		if ($row = mysql_fetch_object($nobr_result)) {
			$recent_cat = $row->cat_ID;
			while ($row = mysql_fetch_object($nobr_result))
				$recent_cat .= ' ' . $row->cat_ID;
		}
		//echo "<code>recent_cat=$recent_cat</code>";
	}
}


//set the $recent_timestamp_min and max from $recent_fromdate, $recent_todate, and $recent_daterange

//echo "<br /><code>$recent_fromdate</code>";
//echo "<br /><code>$recent_daterange</code>";
//echo "<br /><code>$recent_todate</code>";
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";
//echo "<br /><code>".date('H:i:s Y-m-d',strtotime($recent_todate.$recent_daterange))."</code>";
if(!isset($recent_todate)) {
	if (!isset($recent_daterange) || !isset($recent_fromdate) || (strtotime($recent_fromdate . ' ' . $recent_daterange) == -1))
		$recent_timestamp_max = strtotime("now");
	else
		$recent_timestamp_max = strtotime($recent_fromdate . ' ' . $recent_daterange);
} elseif(strtotime($recent_todate) != -1)
	$recent_timestamp_max = strtotime($recent_todate);
else
	$recent_timestamp_max = strtotime("now");
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";

if(!isset($recent_fromdate)) {
	if (!isset($recent_daterange) || (strtotime($recent_todate . ' ' . $recent_daterange) == -1))
		$recent_timestamp_min = strtotime($recent_todate . " -1 month");
	else
		$recent_timestamp_min = strtotime($recent_todate . ' ' . $recent_daterange);
} elseif(strtotime($recent_fromdate) != -1)
	$recent_timestamp_min = strtotime($recent_fromdate);
else
	$recent_timestamp_min = strtotime("now -1 month");
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>";
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>";



//start displaying
echo $recent_before_all;

for( $b=blog_list_start('stub');
		$b!=false;
		$b=blog_list_next('stub') ) {
	if( false == stristr($recent_blogs,$b) ) continue;
	$BlogBList = new ItemList( 
		$b, 
		'', //	$show_statuses = array(),					
		'',	// Specific post number to display
		'', // YearMonth(Day) to display
		'', // Week number
		$recent_cat, // List of cats to restrict to
		'', // Array of cats to restrict to
		$author, // List of authors to restrict to
		'DESC', // ASC or DESC
		'', // list of fields to order by
		'',	//# of posts to display on the page
		'',	// List page number in paged display
		'',//$numposts - $MAXPERPAGE, // Start results at this position
		'',//$numposts - 1, // End results at this position
		'',	// Search string
		'',	// Search for sentence or for words
		'', // Require exact match of title or contents
		'',	// Is this preview
		$numposts, //$default_posts_per_page 
		'paged', //$init_what_to_show
		$recent_timestamp_min,	// Do not show posts before this timestamp
		$recent_timestamp_max  );	// Do not show posts after this timestamp
		
	
	$blog=$b;
	if($recent_show_blogname) {
		echo $recent_before_blogname;
		echo '<a href="';
		blog_list_iteminfo('blogurl', 'raw');
		echo '" title="';
		blog_list_iteminfo( 'shortdesc', 'htmlattr'); 
		echo '">';
		blog_list_iteminfo( 'name', 'htmlbody');
		echo '</a>';
		echo $recent_after_blogname;
	}
	for( ;$BItem = $BlogBList->get_item();) {
		echo $recent_before_each;
		if($recent_showdate) { the_time( $recent_date_fmt ); ?> - <?php }
		echo '<a href="';
		$BItem->Permalink();
		echo '">';
		$BItem->title('','', false);
		echo '</a>';
		if( $disp == 'posts' || $disp == 'single' )
{
  // comment number stuff


		if($recent_ShowCommentNumber) echo '&nbsp;<span class="dimmed">'; comments_number('(0)','(1)','(%d)'); echo '</span>';}
		echo $recent_after_each;
	}
	if($recent_show_blogname) {
		echo $recent_after_bloggroup;
	}
	

} 
echo $recent_after_all;

$blog=$savedblog; //recover from the dirty trick

?>

Jul 09, 2004 15:38

I have a problem with the hack. It only show the number of comment of the last entry, all the other show (0) even though there are comments as you can see at:

http://underbar.org

Jul 09, 2004 16:19

If you follow all of the instructions, in both this and the linked post at the top, then it will work. This is exactly the code used in my copy of _recent.php at tin-men.net.

Jul 09, 2004 18:40

Well I have gone over it one more time and I just don't get it where it went wrong :-/
I used the last code above and followed the instructions.
The _recent.php I saved directly in the skins folder is:

<?php 
   /* 
    * This is the template that displays the links to the recent posts 
    * 
    * This file is not meant to be called directly. 
    * It is meant to be called by an include in the _main.php template. 
    */ 
   if(substr(basename($_SERVER['SCRIPT_FILENAME']),0,1)=='_') 
      die("Please, do not access this page directly."); 

//text to show at the beginning of the recent posts list 
if(!isset($recent_before_all)) $recent_before_all = '<h3>'.T_('  ').'</h3>'; 

//text to show after the recent posts list 
if(!isset($recent_after_all)) $recent_after_all = ' '; 

//text to show before each item 
if(!isset($recent_before_each)) $recent_before_each = ' '; 

//text to show after each item 
if(!isset($recent_after_each)) $recent_after_each = '<br>'; 



//blogs to show in "recent posts" 
if(!isset($recent_blogs)) $recent_blogs = '2'; 
//NOTE: If you set the $recent_blogs to 1, and select the categories that you want 
// to show, then the "recent" links will be ordered by date, most recent first. 
//If you select some blogs, however, you can sort them by blog first, then date. 



//set to 1 to show the blog title/link on the recent posts 
//I recommend not having this set if you're only use blog #1 for "recent posts" 
if(!isset($recent_show_blogname)) $recent_show_blogname = '0'; 
if(!isset($recent_before_blogname)) $recent_before_blogname = '<li>'; 
if(!isset($recent_after_blogname)) $recent_after_blogname = '<ul>'; 
if(!isset($recent_after_bloggroup)) $recent_after_bloggroup = '</ul></li>'; 


//show the number of comments for each "recent" entry. 
if(!isset($recent_ShowCommentNumber)) $recent_ShowCommentNumber = 1; 

//show the date of each post 
if(!isset($recent_showdate)) $recent_showdate=0; 
if(!isset($recent_date_fmt)) $recent_date_fmt='d/m'; 


//max number of posts for each blog in the summary 
if(!isset($numposts)) $numposts = 5; 
//categories to show in "recent posts" 
if(!isset($recent_cat)) $recent_cat =''; //keep out the blogroll blog, whatever it may be 
//Some other options: 
//if(!isset($recent_cat)) $recent_cat = '1 2 3'; //NO ENDING SPACE! 
//if(!isset($recent_cat)) $recent_cat = ''; //show everything in recent posts 
//TODO: add $recent_cat = 'exclude n'; to exclude posts in blog #n 


//THE FOLLOWING ITEMS SET THE DATE RANGE 
//THIS IS TRICKY, SO *PLEASE* READ THIS IF YOU'RE GOING TO PLAY WITH IT 
// all posts from $recent_fromdate to $recent_todate will be shown 
// You can set this up in the following ways: 
//  1. Set both of them to some date, like "01/01/2004" and "01/31/2004" and you'll show all the posts 
//     in a fixed date range. 
//  2. Set ONE of them, and also set $recent_daterange. 
//     If you do this, then the script will set the appropriate "from" and "to" dates. 
//     For example, set $recent_fromdate to "January 1, 2004" and set $recent_daterange to "1 months", 
//     and you'll get posts starting at 1/1/4 and going for one month. 
//     You could also get the same effect by leaving $recent_fromdate unset, and setting $recent_todate 
//     to "1/31/04", and having the $recent_daterange set to '-1 months'. 
// **Use a NEGATIVE $recent_daterange if you're specifying the $recent_todate**  For example '-2 years' 
// **Use a POSITIVE $recent_daterange if you're specifying the $recent_fromdate** For example '1 years' 
//  The script will understand "now" as a valid argument for either the $recent_todate or $recent_fromdate 
//  If you screw it up too bad, it'll just start at the current date and go back 1 month. 
// I've included some examples for you.  Have fun. 
//  --Isaac Z. Schlueter http://isaac.beigetower.org 

if (!isset($recent_todate)) $recent_todate='now'; //show posts UP TO the current time. 
//if (!isset($recent_todate)) $recent_todate='January 1, 2004'; //show posts through 1/1/2004. 
//if (!isset($recent_fromdate)) $recent_fromdate = "01/01/05 23:44:21"; //show posts starting at this date/time 
//only set ONE of the "to" and "from" if you're using a range, or the range is moot 
if(!isset($recent_daterange) ) $recent_daterange = '-1 months'; 


// Do this to use this as a generic evoSkin template file: 
// 1. Save this entire file to your skins directory 
// 2. Copy this file into a particular skin folder, like $blogurl/skins/originalb2/ 
// 3. In $blogurl/skins/skinname/_recent.php, uncomment the next line: 

//    require get_path('skins').'/_recent.php'; 

// 4. In $blogurl/skins/skinname/_recent.php, customize all the things above this point 
// 5. In $blogurl/skins/skinname/_recent.php, delete everything below these instructions. 
// 6. Somewhere in $blogurl/skins/skinname/_main.php, add this line: 

//  require(dirname(__FILE__).'/_recent.php'); 

// 7. Go through and delete all my stupid comments once you get the hang of it. 

// ----------------STOP CUSTOMIZING UNLESS YOU KNOW WHAT YOURE DOING------------------ 

//dirty tricks... 
$savedblog=$blog; 

if ( $recent_cat == 'exclude linkblog') { 
   $recent_cat = ''; 
   if (isset($blogroll_blog) ) { 
      //echo "<code>$blogroll_blog</code>"; 
      $nobr_sql = " SELECT * FROM $tablecategories WHERE cat_blog_id <> $linkblog_blog"; 
//      echo "<code>$request</code>"; 
      $querycount++; 
      $nobr_result = mysql_query($nobr_sql) or mysql_oops($nobr_sql); 
      if ($row = mysql_fetch_object($nobr_result)) { 
         $recent_cat = $row->cat_ID; 
         while ($row = mysql_fetch_object($nobr_result)) 
            $recent_cat .= ' ' . $row->cat_ID; 
      } 
      //echo "<code>recent_cat=$recent_cat</code>"; 
   } 
} 


//set the $recent_timestamp_min and max from $recent_fromdate, $recent_todate, and $recent_daterange 

//echo "<br /><code>$recent_fromdate</code>"; 
//echo "<br /><code>$recent_daterange</code>"; 
//echo "<br /><code>$recent_todate</code>"; 
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>"; 
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>"; 
//echo "<br /><code>".date('H:i:s Y-m-d',strtotime($recent_todate.$recent_daterange))."</code>"; 
if(!isset($recent_todate)) { 
   if (!isset($recent_daterange) || !isset($recent_fromdate) || (strtotime($recent_fromdate . ' ' . $recent_daterange) == -1)) 
      $recent_timestamp_max = strtotime("now"); 
   else 
      $recent_timestamp_max = strtotime($recent_fromdate . ' ' . $recent_daterange); 
} elseif(strtotime($recent_todate) != -1) 
   $recent_timestamp_max = strtotime($recent_todate); 
else 
   $recent_timestamp_max = strtotime("now"); 
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>"; 
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>"; 

if(!isset($recent_fromdate)) { 
   if (!isset($recent_daterange) || (strtotime($recent_todate . ' ' . $recent_daterange) == -1)) 
      $recent_timestamp_min = strtotime($recent_todate . " -1 month"); 
   else 
      $recent_timestamp_min = strtotime($recent_todate . ' ' . $recent_daterange); 
} elseif(strtotime($recent_fromdate) != -1) 
   $recent_timestamp_min = strtotime($recent_fromdate); 
else 
   $recent_timestamp_min = strtotime("now -1 month"); 
//echo "<br /><code>recent_timestamp_min=".date('H:i:s Y-m-d',$recent_timestamp_min)."</code>"; 
//echo "<br /><code>recent_timestamp_max=".date('H:i:s Y-m-d',$recent_timestamp_max)."</code>"; 



//start displaying 
echo $recent_before_all; 

for( $b=blog_list_start('stub'); 
      $b!=false; 
      $b=blog_list_next('stub') ) { 
   if( false == stristr($recent_blogs,$b) ) continue; 
   $BlogBList = new ItemList( 
      $b, 
      '', //   $show_statuses = array(),                
      '',   // Specific post number to display 
      '', // YearMonth(Day) to display 
      '', // Week number 
      $recent_cat, // List of cats to restrict to 
      '', // Array of cats to restrict to 
      $author, // List of authors to restrict to 
      'DESC', // ASC or DESC 
      '', // list of fields to order by 
      '',   //# of posts to display on the page 
      '',   // List page number in paged display 
      '',//$numposts - $MAXPERPAGE, // Start results at this position 
      '',//$numposts - 1, // End results at this position 
      '',   // Search string 
      '',   // Search for sentence or for words 
      '', // Require exact match of title or contents 
      '',   // Is this preview 
      $numposts, //$default_posts_per_page 
      'paged', //$init_what_to_show 
      $recent_timestamp_min,   // Do not show posts before this timestamp 
      $recent_timestamp_max  );   // Do not show posts after this timestamp 
       
    
   $blog=$b; 
   if($recent_show_blogname) { 
      echo $recent_before_blogname; 
      echo '<a href="'; 
      blog_list_iteminfo('blogurl', 'raw'); 
      echo '" title="'; 
      blog_list_iteminfo( 'shortdesc', 'htmlattr'); 
      echo '">'; 
      blog_list_iteminfo( 'name', 'htmlbody'); 
      echo '</a>'; 
      echo $recent_after_blogname; 
   } 
   for( ;$BItem = $BlogBList->get_item();) { 
      echo $recent_before_each; 
      if($recent_showdate) { the_time( $recent_date_fmt ); ?> - <?php } 
      echo '<a href="'; 
      $BItem->Permalink(); 
      echo '">'; 
      $BItem->title('','', false); 
      echo '</a>'; 
      if( $disp == 'posts' || $disp == 'single' ) 
{ 
  // comment number stuff 


      if($recent_ShowCommentNumber) echo '&nbsp;<span class="dimmed">'; comments_number('(0)','(1)','(%d)'); echo '</span>';} 
      echo $recent_after_each; 
   } 
   if($recent_show_blogname) { 
      echo $recent_after_bloggroup; 
   } 
    

} 
echo $recent_after_all; 

$blog=$savedblog; //recover from the dirty trick 

?>

and the _recent.php file I saved in skins/customskin/ is

<?php 
   /* 
    * This is the template that displays the links to the recent posts 
    * 
    * This file is not meant to be called directly. 
    * It is meant to be called by an include in the _main.php template. 
    */ 
   if(substr(basename($_SERVER['SCRIPT_FILENAME']),0,1)=='_') 
      die("Please, do not access this page directly."); 

//text to show at the beginning of the recent posts list 
if(!isset($recent_before_all)) $recent_before_all = '<h3>'.T_('  ').'</h3>'; 

//text to show after the recent posts list 
if(!isset($recent_after_all)) $recent_after_all = ''; 

//text to show before each item 
if(!isset($recent_before_each)) $recent_before_each = ''; 

//text to show after each item 
if(!isset($recent_after_each)) $recent_after_each = '<br>'; 



//blogs to show in "recent posts" 
if(!isset($recent_blogs)) $recent_blogs = '2'; 
//NOTE: If you set the $recent_blogs to 1, and select the categories that you want 
// to show, then the "recent" links will be ordered by date, most recent first. 
//If you select some blogs, however, you can sort them by blog first, then date. 



//set to 1 to show the blog title/link on the recent posts 
//I recommend not having this set if you're only use blog #1 for "recent posts" 
if(!isset($recent_show_blogname)) $recent_show_blogname = '0'; 
if(!isset($recent_before_blogname)) $recent_before_blogname = '<li>'; 
if(!isset($recent_after_blogname)) $recent_after_blogname = '<ul>'; 
if(!isset($recent_after_bloggroup)) $recent_after_bloggroup = '</ul></li>'; 


//show the number of comments for each "recent" entry. 
if(!isset($recent_ShowCommentNumber)) $recent_ShowCommentNumber = 1; 

//show the date of each post 
if(!isset($recent_showdate)) $recent_showdate=0; 
if(!isset($recent_date_fmt)) $recent_date_fmt='d/m'; 


//max number of posts for each blog in the summary 
if(!isset($numposts)) $numposts = 5; 
//categories to show in "recent posts" 
if(!isset($recent_cat)) $recent_cat =''; //keep out the blogroll blog, whatever it may be 
//Some other options: 
//if(!isset($recent_cat)) $recent_cat = '1 2 3'; //NO ENDING SPACE! 
//if(!isset($recent_cat)) $recent_cat = ''; //show everything in recent posts 
//TODO: add $recent_cat = 'exclude n'; to exclude posts in blog #n 


//THE FOLLOWING ITEMS SET THE DATE RANGE 
//THIS IS TRICKY, SO *PLEASE* READ THIS IF YOU'RE GOING TO PLAY WITH IT 
// all posts from $recent_fromdate to $recent_todate will be shown 
// You can set this up in the following ways: 
//  1. Set both of them to some date, like "01/01/2004" and "01/31/2004" and you'll show all the posts 
//     in a fixed date range. 
//  2. Set ONE of them, and also set $recent_daterange. 
//     If you do this, then the script will set the appropriate "from" and "to" dates. 
//     For example, set $recent_fromdate to "January 1, 2004" and set $recent_daterange to "1 months", 
//     and you'll get posts starting at 1/1/4 and going for one month. 
//     You could also get the same effect by leaving $recent_fromdate unset, and setting $recent_todate 
//     to "1/31/04", and having the $recent_daterange set to '-1 months'. 
// **Use a NEGATIVE $recent_daterange if you're specifying the $recent_todate**  For example '-2 years' 
// **Use a POSITIVE $recent_daterange if you're specifying the $recent_fromdate** For example '1 years' 
//  The script will understand "now" as a valid argument for either the $recent_todate or $recent_fromdate 
//  If you screw it up too bad, it'll just start at the current date and go back 1 month. 
// I've included some examples for you.  Have fun. 
//  --Isaac Z. Schlueter http://isaac.beigetower.org 

if (!isset($recent_todate)) $recent_todate='now'; //show posts UP TO the current time. 
//if (!isset($recent_todate)) $recent_todate='January 1, 2004'; //show posts through 1/1/2004. 
//if (!isset($recent_fromdate)) $recent_fromdate = "01/01/05 23:44:21"; //show posts starting at this date/time 
//only set ONE of the "to" and "from" if you're using a range, or the range is moot 
if(!isset($recent_daterange) ) $recent_daterange = '-1 months'; 


// Do this to use this as a generic evoSkin template file: 
// 1. Save this entire file to your skins directory 
// 2. Copy this file into a particular skin folder, like $blogurl/skins/originalb2/ 
// 3. In $blogurl/skins/skinname/_recent.php, uncomment the next line: 

require get_path('skins').'/_recent.php'; 

// 4. In $blogurl/skins/skinname/_recent.php, customize all the things above this point 
// 5. In $blogurl/skins/skinname/_recent.php, delete everything below these instructions. 
// 6. Somewhere in $blogurl/skins/skinname/_main.php, add this line: 

//  require(dirname(__FILE__).'/_recent.php'); 

// 7. Go through and delete all my stupid comments once you get the hang of it. 

// ----------------STOP CUSTOMIZING UNLESS YOU KNOW WHAT YOURE DOING------------------ 

//dirty tricks... 

and the code for including is:

<h3><?php echo T_('5 Senaste Inl?ggen') ?></h3><?php // -------------------------- RECENT POSTS INCLUDED HERE -----------------------------
				require( dirname(__FILE__).'/_recent.php' );
				// -------------------------------- END OF RECENT POSTS ---------------------------------- ?>

Jul 12, 2004 07:42

'<h3>'.T_('  ').'</h3>'; 

I don't think that should be empty.

Just use:

' '

Jul 12, 2004 08:07

Aziza: how is your blog set up? It only displays one post? Is that 1 posts paged or one of the other options? I forget all the exact terms for the options, and I have no idea why it might matter but you might consider changing that portion of your setup and see what happens. I notice that you get the correct number of comments only for the post currently displayed. I guess that's why I wonder what you told b2evo on the posts-paged thing. When I had it operational I was doing 5 posts-paged and never tried any of the other options.

Jul 12, 2004 08:20

This is a known bug, and I'm talking to Isaac about fixing it - sorry! Just to confirm, this will only show the comments for the number of posts currently displayed.

Jul 12, 2004 09:25

EdB:

Yes! I had the posts-paged option marked! Seems I have to show all the entries that I have set the _recent hack to show :-/
Hope Isaac or Graham can make an adjustment for the hack..

EdB wrote:

Aziza: how is your blog set up? It only displays one post? Is that 1 posts paged or one of the other options? I forget all the exact terms for the options, and I have no idea why it might matter but you might consider changing that portion of your setup and see what happens. I notice that you get the correct number of comments only for the post currently displayed. I guess that's why I wonder what you told b2evo on the posts-paged thing. When I had it operational I was doing 5 posts-paged and never tried any of the other options.

Jul 12, 2004 18:11

Aziza,

There are too many versions of that thing floating around for me to be sure what is broken. Please email the _recent.php file(s) that you're using to
b2evo_recent_hack@isaacschlueter.com
(Note: that email address will self-destruct as soon as I get your email, to thwart the spambots.)

So, the Recent Items is only showing 1 post when you are only showing 1 post on your blog? Mine doesn't do that, so it must be something that I can fix :)

Jul 12, 2004 19:03

Fix for 0.9.x...

Find all instances of "comments_number". This must be fixed for any and all of them, in any files that it appears.

Replace this:

      if( $disp == 'posts' || $disp == 'single' ) 
{ 
  // comment number stuff 

      if($recent_ShowCommentNumber) echo '&nbsp;<span class="dimmed">'; comments_number('(0)','(1)','(%d)'); echo '</span>';} 
      echo $recent_after_each; 
   }


With:

// comment number stuff 
if($recent_ShowCommentNumber) 
{
    echo '&nbsp;<span class="dimmed">';
    $BItem->feedback_link( 'feedbacks', '', '', '0', '1', '%'); 
    echo '</span>';
}
echo $recent_after_each;

Note the enhanced readibility (each ; should have a newline right after it, unless absolutely necessary,) the lack of {} messiness/redundancy, and the fact that the deprecated function was removed.

Jul 13, 2004 03:25

Okay the subject is somewhat of a lie.

for( ;$BlogBList->get_item();) {
		echo $recent_before_each;
		if($recent_showdate) { the_time( $recent_date_fmt ); ?> - <?php }
		echo '<a href="';
		permalink_link();
		echo '" title="';
		the_time( "d/m/Y : g:i:s A" );
		echo '">';
		the_title( '', '', false );
		echo '</a>';
		if($recent_ShowCommentNumber) comments_number('(0)','(1)','(%)');
		echo $recent_after_each;
	}


That section there forms the links that will show up the main page (anyways you knew that), but my problem is when the links are formed it uses blog_all.php to link to the entries. So the link looks something like this

<a href="http://something.com/something/blog_all.php?p=36&more=1&c=1&tb=1&pb=1">Entry Title</a>

Where I want it to work like this

<a href="http://something.com/something/blog_stub.php?p=36&more=1&c=1&tb=1&pb=1">Entry Title</a>

I know I am using an older version of the script but I'm stuck with 0.8.9 since I designed my skins with it and I don't want to go through all the work of changing them for a new version.

Jul 13, 2004 04:49

OK, everybody who's having problems with the comment number:
A new version of the file is at http://isaacschlueter.com/recent.zip as of 2 minutes ago. Please let us all know if this works now.

I know I am using an older version of the script but I'm stuck with 0.8.9 since I designed my skins with it and I don't want to go through all the work of changing them for a new version.

Here are your options for that:

1. Upgrade your skins. (It's not really that hard. Just go to [url=http://b2evolution.net/man/2004/06/04/template_functions]the list of functions[/url] and swap out the old for the new. Look at the existing 0.9.x skins for guidance.)

2. Modify this line to set the "$recent_blogs" to '2' or '2 3' or something:

if(!isset($recent_blogs)) $recent_blogs = '1';

I write books in my comments, so it shouldn't be too hard.

3. Rewrite the permalink function in 0.8 so that it grabs the correct blog instead of the all blogs blog. (While you're at it, why not also fix all the 0.8 bugs, add an enhanced anti-spam utility, and fix tons of annoying little bugs.)

Jul 13, 2004 07:35

Getting a 404 on that link...

Jul 13, 2004 08:50

I'm a little confused by the response. What is the best option for me to fix my problem?

Is the permalink function done better in 0.9 (I know it was changed to $Item...) I know if I do as you suggest

Modify this line to set the "$recent_blogs" to '2' or '2 3' or something

The entries will no longer be sorted by date, but by blog. And having the entries sorted by date is what I want.

Jul 13, 2004 18:02

Drew you should download .9.0.10 and check out a skin to see about migrating yours to the way it's done now. If all your customization is in the skin (_main and the css mostly?) then it's really pretty straightforward - especially if you started from one of the b2evo skins.

Isaac I get a page not found when I go for the most recent zip you just posted (12-June, 19:49). I am getting an error when I use the version from 12-June @ 10:15 but only when I am on a blog with posts and I go to the profile link. I get one recent post displayed then

Warning: Invalid argument supplied for foreach() in /home/gorgonzola/public_html/b2evocore/_functions_comments.php on line 41

followed by a little MySQL error box that says

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY comment_post_ID, comment_type' at line 3(Errno=1064)

Your query:
SELECT comment_post_ID, comment_type, COUNT(*) AS type_count FROM evo_comments WHERE comment_post_ID IN () GROUP BY comment_post_ID, comment_type

Hmmm. It's bad when I go to the profile link, so why don't I just delete the profile link?

Jul 15, 2004 17:43

The 404s were due to my host moving some stuff around to upgrade my acct, and not doing a very good job of it. It appears that, even though $postIDlist was set, I have to handle $postIDarray as well. Should be all fixed now.

Graham or EdB or someone: wanna check out the [url=http://isaacschlueter.com/recent.zip]new version[/url]? I think that I fixed the problem, but I don't have an installation to test it on here. I've noticed that FTP has a tendency sometimes to mess up the last modified date, but this version should have "2004-07-15 08:27:41" in the comments up near the top.

Drew: You're asking for the moon. We're giving you a rocket. You're telling us that you want the moon but you won't get in the rocket. Work with us here, man.

Jul 15, 2004 18:22

Welcome back Isaac. I was just about to tape your avatar to a little carton of milk...

Downloaded and installed this version (with the date/time in it) and it's mostly good. I put comments on some entries and found that I could not duplicate the "comments counted only on active post" issue. Tried with 5 posts-paged, 1 posts-paged, and 1 post - all good. Also the issue I had with "doing profile breaks recent" is gone. Only problem remaining is blogs over 9 act like blog 1 (the stristr($recent_blogs,$b) thing?).

Enjoy, EdB

Jul 15, 2004 18:57

Hahah, Ed, I'm touched. Been spending a bunch of time at orkut, and on a few other things.

I'll see about handing it as an array, since it seems like that's the last thing that would have to be done, and then it'll be picture perfect (or just about.) Maybe today at lunch, maybe tonight when I get home.

Jul 17, 2004 09:17

Isaac, don't know if you got my mail - anyway, do you know why my statspage is acting like this: http://underbar.org/index.php/a?disp=stats

Look further down in the sidebar where the recent thing is, i get warnings in functions_comments.php

isaac wrote:

Hahah, Ed, I'm touched. Been spending a bunch of time at orkut, and on a few other things.

I'll see about handing it as an array, since it seems like that's the last thing that would have to be done, and then it'll be picture perfect (or just about.) Maybe today at lunch, maybe tonight when I get home.

Jul 17, 2004 10:58

I've informed Isaac of this one. It's because it's trying to do something fancy with the comments twice or something. a tempary fix is to just disable comments for the time being - not ideal, I know, but it's better than ugly great errors...

Jul 17, 2004 11:08

Ahhh, that's why. Well disabling comments doesn't feel like an option in my case... I'll wait for Isaacs fix :-))
Thanks for your reply!

Graham wrote:

I've informed Isaac of this one. It's because it's trying to do something fancy with the comments twice or something. a tempary fix is to just disable comments for the time being - not ideal, I know, but it's better than ugly great errors...

Aug 01, 2004 18:28

Just a quick thanks for this hack :)

Installed in less than 5 minutes - which is good for me!

Just what I needed.

Aug 12, 2004 12:33

Quick Question - how can I edit the recent to only display recent entries in a particular blog?

It is listing my main blog + linkage - I don't want linkage to be featured in recent entries.

Aug 15, 2004 21:23

I was having problems getting this hack to display the most recent entry. For some reason the most recent entry would only show up only if it was not posted on today's date (ie it had to be at least a day old).

Is this a normal? Does anyone have the hack displaying entries that was posted on the current date?

I just grabbed the latest version and forced the issue by setting the $recent_todate to a year in the future and telling the $recent_daterange to be padded by -12months in addition to the range I wanted (which was a year so it became -24months).

Aug 16, 2004 10:38

I made a similar hack for last comments ([url=http://kaste.lv/~captsolo/info/blog_a.php/2004/08/15/b2evo_last_commented_posts]see here[/url]).

More discussion - [url=http://forums.b2evolution.net/viewtopic.php?t=2110]on this forum entry[/url].

Isaac, can you tell me what is needed to get the function " comments_number('(0)','(1)','(%d)'); " running? I would like to use it in my script as well, but it returns just (0) for me. I need to pass it post ID somehow. Since it is not a member of Item class, I cannot do just $Comment->Item->comments_number().

P.S. I saw your modification to _recent.php using feedback_links, but I think having a number of comments in brackets is simpler and nicer. Besides, neither did feedback_link work in my code.

Aug 27, 2004 09:51

Bug with "Recent posts" lists:

1) When there is no title for the post, it does not show a link to that blog entry.

2) When I go to a particular post in a particular blog, "Recent posts" should be displaying this blog's recent entries. Instead it is displaying all blogs together.

Also a possible improvement - for recent entry links to have title="some text" displaying additional information. See how it works for last comments hack.

Jan 08, 2006 02:49

To make this hack show only the recent posts in the particular blog you're looking at just look for this part of the code:

 //blogs to show in "recent posts" 
if(!isset($recent_blogs)) $recent_blogs = '1';

and change '1' for $blog -do not use quotes.

I changed this piece of code:

//text to show at the beginning of the recent posts list 
if(!isset($recent_before_all)) $recent_before_all = '<h3>'.T_('Recent Posts').'</h3><ul>'; 

//text to show after the recent posts list 
if(!isset($recent_after_all)) $recent_after_all = '</ul>';

for this one:

 //text to show at the beginning of the recent posts list 
 if(!isset($recent_before_all)) $recent_before_all = '<div class="bSideItem"><h3>Recent Posts</h3><ul>'; 
  
 //text to show after the recent posts list 
 if(!isset($recent_after_all)) $recent_after_all = '</ul></div>'; 

to make sure the output would match the sidebar style.

I installed it locally and I've been trying it for the last couple days. It works great!

Jan 26, 2006 22:51

I don't supposed anybody's gotten this neat script to work in Phoenix? I naively assumed it would when I upgraded, and was proven wrong when nothing showed up between the ul tags.

Feb 14, 2006 22:54

My problem seems pretty weird to me. here it goes: I have a blog using the a skin with the "recent posts" list working just great. Today one of my bloggers started using it and the recent posts lists, in that blog only, is showing posts from different blogs. I changed my own skin to check it out and it is working just fine.

Anyone has any idea what might be going on?

Here is the link to the one not working:
http://weblogs.escrever.org/index.php/mestre_xaman?skin=moonrise

and here two working just fine:
http://weblogs.escrever.org/index.php/serena
http://weblogs.escrever.org/index.php/faq

TIA!

Feb 15, 2006 18:55

while I was trying to figure out what the problem was I started changing all the blogs I host to that particular skin (the only one so far to have the _recent posts list) and I now know what is happening but no idea how to fix it.
The same weird thing is happening with ALL blogs over blog #9. So it all starts with #10 and above.

By request, I had to change the skin of the other blog, the one I left the link to, so I got a new link here, this one is not working the way it should:
http://weblogs.escrever.org/index.php/fffff

Anyone has any idea?

Apr 12, 2006 16:59

Sadly, I can't get the comments number to work on any page but the main index.php. I can't seem to figure out what I need to tweak to fix it, either. I'm running Paris, by the way.

Take a look - www.autodogmatic.com if you think you might have an idea of what's wrong.

Aug 28, 2006 15:37

Has this been updated for 1.8.1?


Form is loading...

b2evolution CCMS – This forum is powered by b2evolution CMS, a complete engine for your website.