Recent Topics

1 Feb 03, 2007 11:35    

In b2evo everytime you add blog it goes to the bottom of the list and display last.

I think this is not very convenient. So I created this hack to enable me to manage how the blog will display.

Step-1: Add a field to your evo_blogs SQL table with the following property and make it UNIQUE:

Name: blog_disp_order
Type: int(2)


Step-2
- Make the following changes to /blog/inc/MODEL/collections/_blog.class.php

Insert after line 180; ($this->UID = $db_row->blog_UID;)

$this->disp_order = $db_row->blog_disp_order;



Insert after line 291; ($this->set( 'tagline', format_to_post( $Request->get( 'blog_tagline' ), 0, 0 ) );}

// Added to set display order		
		if( $Request->param( 'blog_disp_order',   'html', NULL ) !== NULL )
		{	// HTML disp_order:
			$this->set( 'disp_order', format_to_post( $Request->get( 'blog_disp_order' ), 0, 0 ) );

Step-3- Make the following changes to /blog/inc/MODEL/collections/_blog.funcs.php
// change this (line 466)

//		foreach( $DB->get_results( "SELECT * FROM T_blogs ORDER BY blog_ID", OBJECT, 'blog_load_cache()' ) as $this_blog )


// to this

foreach( $DB->get_results( "SELECT * FROM T_blogs ORDER BY blog_disp_order", OBJECT, 'blog_load_cache()' ) as $this_blog )

Step-4- Make the following changes to /blog/inc/VIEW/collections/_blogs_general.form.php

Insert after line 104; $Form->select( 'blog_locale', $edited_Blog->get( 'locale' ), 'locale_options_return', T_('Main Locale'), T_('Determines the language of the navigation links on the blog.') );

// A field for the blog display order 
	$Form->text( 'blog_disp_order', $edited_Blog->get( 'disp_order'), 5, T_('Display Order'), T_('This will determine the order in which to display the blog.') );


Step-5
- Make the following changes to /blog/inc/VIEW/collections/_blogs_list.php

Insert after line 115; <td class="center"><?php locale_flag( blog_list_iteminfo('locale', false) ) ?></td>

<? // ---------------- added to blogs display order in blog List----------  ?> 
		<td class="center"><?php blog_list_iteminfo('disp_order') ?></td>	


This works with all b2evo that uses CMV framework. If you use an older version, please leave a reply in this forum.

I would suggest that you set blog_display order (blog general form) to odd numbers like 1,3,5,.. or 1,5,9,... that will help insert new blog in between easily.

I'm hoping to make this hack as plugin, although I'm an amateur with plugin.

That is it, enjoy.

2 Mar 03, 2007 13:57

Hi, tried the hack but got the following message...

Parse error: parse error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\Documents and Settings\HP_Administrator\My Documents\websites\b2evolution\blogs\inc\MODEL\collections\_blog.class.php on line 1033

--

I tried moving the line up and down the function and double checked for ; but to no avail... any ideas?

v.1.9.2

thanks,

3 Mar 18, 2007 23:48

This hack presented here by EdB, not only does the job well, but it is explained wonderfully. Edb is a certifiable genius when it comes to finding solutions and describing them so they are easily understood.

http://forums.b2evolution.net/viewtopic.php?t=10912

Check it out... it works.

Sam


Form is loading...