Recent Topics

1 May 09, 2010 11:45    

My b2evolution Version: 3.3.3

Hello,

I've found a couple of other threads ([url=http://forums.b2evolution.net/viewtopic.php?t=8162&start=30&postdays=0&postorder=asc&highlight=latest+posts&sid=aa0c7f6ecea16d37ba01dba216ce9dfb]like this one[/url]) about this but couldn't find a solution that does what I'm after and still works on the latest b2e.

My site will have several blogs and I'd like the main blog to list the most recent posts across all blogs. At the moment I'm just aggregating the blogs and it's almost what I want, but I'd just like to exclude the post content and just show the title, author, time.

I took a look at summary.php and it's kinda what I'm after with the cut-down post summaries but I'd just like the x most recent posts across all blogs and not latest x posts per blog (and it seems I'm not savvy enough to modify it myself).

Also tried the default simple post list widget, but it's a bit... simple (titles only). Also a 3rd party "article titles" widget and a "latest post" widget but they're basically they same.

Any suggestions appreciated!

2 May 09, 2010 11:56

Spoondog wrote:

My b2evolution Version: 3.3.3
I'd just like to exclude the post content and just show the title, author, time.

Spoondog wrote:

Also tried the default simple post list widget, but it's a bit... simple (titles only).

I dont get exactly what your problem is .. so your problem is, latest posts widget or post list widget displays the title, that is okay, but you want it to show the author and the time in addition ? is that it

3 May 16, 2010 03:55

so your problem is, latest posts widget or post list widget displays the title, that is okay, but you want it to show the author and the time in addition ? is that it

I guess that's it, yes. But it'd also be nice to group the posts by date e.g.

16/05/2010

[u]We're up and running![/u] - author one - 14:15
[u]The usual news[/u] - author seven - 00:28
[u]thing cancelled[/u] - author three - 10:08

15/05/2010

[u]New site![/u] - author two - 14:20

etc...

4 May 16, 2010 04:39

Okay, off the top of my head, you could get exactly what you want by doing the following;

create a new custom display: http://forums.b2evolution.net/viewtopic.php?t=14046

call it disp_postlist or whatever..

in that custom display(page)

put this within post loop

			$MainList->date_if_changed( array(
					'date_format' => '#',
				) );

this will do the date thing you want..

as you dont want any content, just put the title in the loop

<?php $Item->title(); ?>

and the author & time right by side

	<?php	

      $Item->author( array(
				'after'        => '&nbsp;-&nbsp; ',
			) );

		$Item->issue_time( array(
			));	

That's about it.

5 May 16, 2010 10:20

Thank you - I can get the custom page to display but I'm not sure how to get a post loop in there - do I copy some post loop code from a particular file and put it in my custom display page? (and include your code).

Don't know my way around this very well at all :-/

6 May 16, 2010 12:07

yep, you can just duplicate your skin's posts.main.php and remove the bits you dont need there or add..

7 May 17, 2010 01:26

Cheers mate I'll give that a try.

8 May 22, 2010 10:45

Ok, there must be something I'm missing... I can get the custom display page to show, but I can't get any posts to show up.

This is what my custom display page looks like:

<?php
   
	//Check page isn't being accessed directly
	if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
	{
	    echo 'just a test line to see if the page is working';
	    // ------------------------------------ START OF POSTS ----------------------------------------
		// Display message if no post:
		display_if_empty();
	
		while( $Item = & mainlist_get_item() )
		{	// For each blog post, do everything below up to the closing curly brace "}"
			
		// ------------------------------ DATE SEPARATOR ------------------------------
		$MainList->date_if_changed( array(
			'date_format' => '#',
			) );
			
		// ------------------------------ POST DETAILS ------------------------------
	        
		$Item->title();
	
		$Item->author( array(
			'after'        => '&nbsp;-&nbsp; ',
			) );
	
		$Item->issue_time( array(
			));
	
		// ---------------------- ITEM BLOCK INCLUDED HERE ------------------------
		skin_include( '_item_block.inc.php', array(
				'content_mode' => 'auto',		// 'auto' will auto select depending on $disp-detail
				'image_size'	 =>	'fit-220x165',
			) );
		// ----------------------------END ITEM BLOCK  ----------------------------
	
		} // ---------------------------------- END OF POSTS ------------------------------------
		
		// -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------
		mainlist_page_links( array(
				'block_start' => '<div class="navigation">',
				'block_end' => '</div>',
	   			'prev_text' => '&lt;&lt;',
	   			'next_text' => '&gt;&gt;',
			) );
		// ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------
	}
?>


...only thing that appears is my test echo at the top :-/

9 May 22, 2010 14:14

which skin are you using

10 May 22, 2010 22:13

tilqicom wrote:

which skin are you using

All will produce the same results ;)

You need to leave $disp as posts, otherwise you'll get no results.

Change your url to ?my_disp=whatever and then, in your posts.main.php change the very top of the file to read :

<?php
if( param('my_disp', 'string' ) )
{
   // include your custom disp
  exit();
}

¥

11 May 23, 2010 03:43

OK - I'm using the nifty corners skin and it doesn't actually have a posts.main.php... do I just make a blank one?

12 May 23, 2010 12:27

yep.. ¥åßßå was right.. it was not as straight-forward as i thought

13 May 23, 2010 13:56

I changed the URL to "?my_disp=allsports" and created a posts.main.php in the skin folder, but I get this error:

Warning: settype() [function.settype]: Invalid type in /home/ab4295/public_html/blogs/inc/_core/_param.funcs.php  on line 260
just a test line to see if the page is working

(so my test echo shows up... which is a start) This is what my posts.main.php looks like:

<?php
if( param('my_disp', 'allsports' ) )
{   
	//Check page isn't being accessed directly
	if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
	{
	    echo 'just a test line to see if the page is working';
	    // ------------------------------------ START OF POSTS ----------------------------------------
		// Display message if no post:
		display_if_empty();
	
		while( $Item = & mainlist_get_item() )
		{	// For each blog post, do everything below up to the closing curly brace "}"
			
		// ------------------------------ DATE SEPARATOR ------------------------------
		$MainList->date_if_changed( array(
			'date_format' => '#',
			) );
			
		// ------------------------------ POST DETAILS ------------------------------
	        
		$Item->title();
	
		$Item->author( array(
			'after'        => '&nbsp;-&nbsp; ',
			) );
	
		$Item->issue_time( array(
			));
	
		// ---------------------- ITEM BLOCK INCLUDED HERE ------------------------
		skin_include( '_item_block.inc.php', array(
				'content_mode' => 'auto',		// 'auto' will auto select depending on $disp-detail
				'image_size'	 =>	'fit-220x165',
			) );
		// ----------------------------END ITEM BLOCK  ----------------------------
	
		} // ---------------------------------- END OF POSTS ------------------------------------
		
		// -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------
		mainlist_page_links( array(
				'block_start' => '<div class="navigation">',
				'block_end' => '</div>',
	   			'prev_text' => '&lt;&lt;',
	   			'next_text' => '&gt;&gt;',
			) );
		// ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------
	}
	exit();
}
?>

14 May 23, 2010 16:09

There is no param type allsports ;)

If you don't have a posts.main then you can modify index.main.php instead, it'd be a tad easier

find :

// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
skin_init( $disp );

Change to :

// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
skin_init( $disp );
if( param('my_disp', 'string' ) )
{
  $disp = param('my_disp', 'string' );
}

Your original custom disp page should now work.

¥

15 May 24, 2010 01:35

Thanks ¥åßßå B) I'll give that a try when I get home.

16 May 24, 2010 13:19

Right... so following your instructions I got the custom disp page showing (I had to put skin_init( $disp ); after the if( param('my_disp', 'string' ) ) bit).

However I'm now back to my original problem of getting these posts to show up (and in the format mentioned in my second post). I basically just copied what I thought was the "posts" section of index.main.php to my custom _allsports.disp.php and added the lines tilqicom suggested... but the only thing that shows up are the test echos:

_allsports.disp.php

<?php
	//Check page isn't being accessed directly
	if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
	{
	    echo 'just a test line to see if the page is working<br>';
	    // ------------------------------------ START OF POSTS ----------------------------------------
		// Display message if no post:
		display_if_empty();
	
		while( $Item = & mainlist_get_item() )
		{	// For each blog post, do everything below up to the closing curly brace "}"
			
		// ------------------------------ DATE SEPARATOR ------------------------------
		$MainList->date_if_changed( array(
			'date_format' => '#',
			) );
			
		// ------------------------------ POST DETAILS ------------------------------
	        
		$Item->title();
	
		$Item->author( array(
			'after'        => '&nbsp;-&nbsp; ',
			) );
	
		$Item->issue_time( array(
			));
	
		// ---------------------- ITEM BLOCK INCLUDED HERE ------------------------
		skin_include( '_item_block.inc.php', array(
				'content_mode' => 'auto',		// 'auto' will auto select depending on $disp-detail
				'image_size'	 =>	'fit-220x165',
			) );
		// ----------------------------END ITEM BLOCK  ----------------------------
	
		} // ---------------------------------- END OF POSTS ------------------------------------
		
		// -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------
		mainlist_page_links( array(
				'block_start' => '<div class="navigation">',
				'block_end' => '</div>',
	   			'prev_text' => '&lt;&lt;',
	   			'next_text' => '&gt;&gt;',
			) );
		// ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------
		echo 'just another test line to see if the page got through';
	}
?>

17 May 24, 2010 14:56

¥åßßå wrote:

You need to leave $disp as posts, otherwise you'll get no results.

Add the following to your index.main.php, and see what it spits out :

if( is_logged_in() )
{
  pre_dump( $disp );
}
if( param( 'my_disp' ..........

You can delete the new code after you've refreshed, obviously you need to be logged in to see the output ;)

¥

18 May 25, 2010 14:37

This is what it spits out:

Warning: Cannot modify header information - headers already sent by (output started at /home/ab4295/public_html/blogs/inc/_core/_misc.funcs.php:1441) in /home/ab4295/public_html/blogs/inc/_core/_template.funcs.php on line 59

19 May 25, 2010 17:16

Just before that it should have shown you the output of pre_dump()

¥

20 May 26, 2010 15:44

Ah - the admin bar was covering it up! This is what it says:

string(5) "posts"

21 May 26, 2010 16:48

Excellent, that's what it needs to be.

So, lets start again, the link to your page needs to be :

http://domain.tld/?my_disp=allsports

You then change index.main.php as below :
¥åßßå wrote:

find :

// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
skin_init( $disp );

Change to :

// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
skin_init( $disp );
if( param('my_disp', 'string' ) )
{
  $disp = param('my_disp', 'string' );
}

Then, further down in the file your code should look like :

John wrote:

<?php
		// -------------- MAIN CONTENT TEMPLATE INCLUDED HERE (Based on $disp) --------------
		skin_include( '$disp$', array(
				'disp_posts'  => '',		// We already handled this case above
				'disp_single' => '',		// We already handled this case above
				'disp_page'   => '',		// We already handled this case above
              'disp_allsports'	 => '_allsports.disp.php',
				) );
		// Note: you can customize any of the sub templates included here by
		// copying the matching php file into your skin directory.
		// ------------------------- END OF MAIN CONTENT TEMPLATE ---------------------------
	?> 

If you then hit that url, after changing to the appropriate domain, then you should get your custom disp && posts

¥

22 May 27, 2010 13:59

Ok... no luck.

PM'ing you the URL and details if you don't mind... seeing it might help.

23 May 27, 2010 19:46

Your problem is the naff "redirect to canonical urls" stuff that's in recent versions of evo :-S

admin > blog settings > [blog] > seo, untick all the canonical redirect crap > hit save > hit the url you pm'd me with, with the last file changes I posted > hopefully smile.

Why the hell blog software feels that it should do search spiders work for them is beyond me, they earn enough money to pay their own programmers to sort their own shit algorithms out. /rant

¥

24 May 29, 2010 04:50

Cool thanks I turned all those off.

Now the problem is, the test echo at the beginning of my custom display shows after the posts... is it even going to be possible to alter the appearance of the posts using a custom display page?

25 Jul 10, 2010 03:23

Any ideas on this?

I've tried tilqicom's method of creating a custom display page to modify the post contents - I have the custom display working now but I can't seem to do anything to the posts with it (not sure if I'm doing it right).

[u]To recap[/u] - I'm looking to get a summary of posts from other blogs, so it looks something like this on the main page:

16/05/2010

[u]We're up and running![/u] - author one - 14:15
[u]The usual news[/u] - author seven - 00:28
[u]thing cancelled[/u] - author three - 10:08

15/05/2010

[u]New site![/u] - author two - 14:20

etc...

I took a look at summary.php and it's kinda what I'm after with the cut-down post summaries but I'd just like the x most recent posts across all blogs and not latest x posts per blog (and it seems I'm not savvy enough to modify it myself).

Again, any help appreciated!

26 Aug 01, 2010 03:39

FYI - I ended up just aggregating the blogs I wanted to include in the post summary and duplicating the skin folder, commenting out the parts of the post I didn't need in _item_block.inc.php and a few css style edits - got exactly what I was after!


Form is loading...