Recent Topics

1 Jun 02, 2005 06:47    

hello

my link blog isnt sorted by date...whenever i post somethning new ..it goes randomly ...

i want the last link i post to my link blog to be at end...

but it seems like is is sorted by alphabet.

check my site
http://northerniraq.info/news/

the News on Focus is my Link Blog Section.

it apears like this
* Kurdish leader Barzani to head new regional government Permalink
* PKK Offers Ceasefire To Turkey Permalink
* PKK Well Stocked with C4 Explosives Permalink
* Rice supports Turkey’s EU Membership Permalink
* Sheikh Mohammad Mashouk al-Khaznawi killed Permalink
* Turkish PM to meet Bush Permalink

but the trut is this news :
* PKK Offers Ceasefire To Turkey Permalink

was the last one I posted in the News on Focus Section.

but it goes to 2th place.

mind that I edited the link blog template . to detel the "Link Blog" Word
in the way that graham told me .here
http://forums.b2evolution.net/viewtopic.php?t=4305&highlight=

2 Jun 04, 2005 00:27

anybody can tell me why my link blog is not sorted by date?
it shows in a unreglare sort... i dont know why...

3 Jun 04, 2005 11:28

your linkblog is sorted alphabeticaly.. nog irregulary...

4 Jun 04, 2005 11:30

What you do need, if you want the 'recent posts in a certain blog/categorie) is this code, Isaac made :

<?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 = '<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 = $blog;
//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 linkblog blog
//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://isaacschlueter.com

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 = '-3 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') {
	if( !isset( $linkblog ) )
	{	// No link blog explicitely specified, we use default:
		$linkblog = $Blog->get('links_blog_ID');
	}
	// echo "<code>$recent_cat</code>";
	$recent_cat = '';
	if ($linkblog) {
		// echo "<code>$linkblog</code>";
		$nobr_sql = " SELECT * FROM $tablecategories WHERE cat_blog_id <> $linkblog";
		$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;
		$recent_last_date = $BItem->get('issue_date');
		// echo "\$recent_last_date = $recent_last_date - " . date( 'Y-m-d', strtotime($recent_last_date));
		if($recent_showdate) { $BItem->issue_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">'; 
				$BItem->feedback_link( 'feedbacks', '', '', '', '(1)', '(%d)', '#', '#', true ); 
				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
$recent_cat ='';
?>

5 Jun 04, 2005 22:13

so i should diable showing the link blog in my main blog and then copy paste this code to tmy Main Page template ?

is chanign the blogname the only change I need to do ?

which blog name i should replace the blogname , the short name or full name that has Space in it ?

6 Jun 04, 2005 22:56

Instead of including your _linkblog.php, you include _recent.php.

The code that is right above this post is the code that you should save as _recent.php
and in your _main.php file you do this :

<?php require( dirname(__FILE__).'/_recent.php' ); ?>

Does that makes sence ?

7 Jun 04, 2005 23:00

and what about changes in the code...for example i want the recent post titles
of the Focus blog be showed on the main blog...what should I do ...exacly ?
:roll: thanks for help in advance.

8 Jun 05, 2005 21:16

I do this :

		<?php $recent_blogs = 3; $recent_cat ='98'; require( dirname(__FILE__).'/_recent.php' ); ?>


If I want the recent post of cetagory 98 in blog 3...

9 Jun 07, 2005 06:22

thanks it works so well , can I know, how many recent posts it gonna show ?
it wont show all of the posts in that blog .right?

10 Jun 07, 2005 06:33

do you think we can add these Recent Topics on the other sites as well ?

i mean can we add the latest topic of this blog on another domian name of anothet site by this mod ? :roll:

11 Jun 07, 2005 09:19

You will see somewhere in the code

if(!isset($numposts)) $numposts = 5;//max number of posts for each blog in the summary  


change that to whatever you want.

You can use this within the realm of this b2evo installation.

12 Jul 09, 2005 20:48

Ok, now I have a question along the same lines as this. Hopefully this wasn't answered already.

How do you organize the linkblog to show links by group instead of date? I don't want the links to be organized by date within the group listing either.

Is this possible?

13 Jul 08, 2007 17:24

i have been working on this for a few days now. i created the _recent.php file from this post and inserted it into my skin but rather than posts I only get the blog title, not posts.

what am i doing wrong?

//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 = '1'; 
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 = 0; 

//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 ='0'; //keep out the linkblog blog 
//Some other options: 
//if(!isset($recent_cat)) $recent_cat = '1 2 3'; //NO ENDING SPACE! 
//if(!isset($recent_cat)) $recent_cat = '4'; //show everything in recent posts 
//TODO: add $recent_cat = 'exclude n'; to exclude posts in blog #n 

thanks in advance


Form is loading...