Recent Topics

1 Sep 04, 2006 12:39    

I am looking for a way to make the blog list show as a drop down menu.

Does anyone know how to do this in a skin?

When here are many blogs on a site it is nicer to have them as a drop down list.

Thx.

3 Sep 12, 2006 09:26

No not yet. Still waiting for suggestions :-)

4 Sep 12, 2006 19:57

You need to alter skins/<skin name/_bloglist.php ;)

¥

5 Sep 12, 2006 21:35

<?php
	/**
	 * This is the template that displays the links to the available blogs
	 *
	 * This file is not meant to be called directly.
	 * It is meant to be called by an include in the _main.php template.
	 *
	 * b2evolution - {@link http://b2evolution.net/}
	 * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
	 * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
	 *
	 * @package evoskins
	 */
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

if( ! $display_blog_list )
{ // We do *not* want the blog list to be displayed
	return;
}

if(!isset($blog_list_as_list)) $blog_list_as_list = false;
if ( $blog_list_as_list )
{
	$blog_list_separator = '';
	echo
	'<form action="'.regenerate_url().'" enctype="multipart/form-data" method="get">'.
	'<select name="blog">';
} else
{
	# this is what will start and end your blog links
	if(!isset($blog_list_start)) $blog_list_start = '<ul>';
	if(!isset($blog_list_end)) $blog_list_end = '</ul>';
	# this is what will separate your blog links
	if(!isset($blog_item_start)) $blog_item_start = '<li>';
	if(!isset($blog_item_end)) $blog_item_end = '</li>';
	# This is the class of for the selected blog link:
	if(!isset($blog_selected_link_class)) $blog_selected_link_class = '';
	# This is the class of for the other blog links:
	if(!isset($blog_other_link_class)) $blog_other_link_class = '';
	# This is additionnal markup before and after the selected blog name
	if(!isset($blog_selected_name_before)) $blog_selected_name_before = '[';
	if(!isset($blog_selected_name_after)) $blog_selected_name_after = ']';
	# This is additionnal markup before and after the other blog names
	if(!isset($blog_other_name_before)) $blog_other_name_before = '';
	if(!isset($blog_other_name_after)) $blog_other_name_after = '';
	# This is the blogparam that will be displayed as the name:
	if(!isset($blog_name_param)) $blog_name_param = 'shortname';
	# This is what will separate items in the list
	if(!isset($blog_list_separator)) $blog_list_separator = '';
}
# This is the blogparam that will be displayed as the link title:
if(!isset($blog_title_param)) $blog_title_param = 'name';


$blog_links = array(); // we collect all links first, to easily implode them

if ( $blog_list_as_list )
{
	for( $curr_blog_ID = blog_list_start();
			$curr_blog_ID != false;
			 $curr_blog_ID = blog_list_next() )
	{
		$blog_link = '<option value="'.$curr_blog_ID.'">'.format_to_output( blog_list_iteminfo($blog_title_param, false), 'htmlattr' ).'</option>';
		$blog_links[] = $blog_link;
	}
} else
for( $curr_blog_ID = blog_list_start();
			$curr_blog_ID != false;
			 $curr_blog_ID = blog_list_next() )
{
	if( !blog_list_iteminfo( 'in_bloglist', false ) )
	{ // don't show
		continue;
	}
	$blog_link = $blog_item_start;
	if( $curr_blog_ID == $blog )
	{ // This is the blog being displayed on this page:
		$blog_link .= '<a href="';
		$blog_link .= blog_list_iteminfo('blogurl', false);
		$blog_link .= '" class="'.$blog_selected_link_class.'" title="';
		$blog_link .= format_to_output( blog_list_iteminfo($blog_title_param, false), 'htmlattr' );
		$blog_link .= '">';
		$blog_link .= $blog_selected_name_before;
		$blog_link .= format_to_output( blog_list_iteminfo($blog_name_param, false ), 'htmlbody' );
		$blog_link .= $blog_selected_name_after;
		$blog_link .= '</a>';
	}
	else
	{ // This is another blog:
		$blog_link .= '<a href="';
		$blog_link .= blog_list_iteminfo('blogurl', false);
		$blog_link .= '" class="'.$blog_other_link_class.'" title="';
		$blog_link .= format_to_output( blog_list_iteminfo($blog_title_param, false), 'htmlattr' );
		$blog_link .= '">';
		$blog_link .= $blog_other_name_before;
		$blog_link .= format_to_output( blog_list_iteminfo($blog_name_param, false), 'htmlbody' );
		$blog_link .= $blog_other_name_after;
		$blog_link .= '</a>';
	} // End of testing which blog is being displayed
	$blog_link .= $blog_item_end;

	$blog_links[] = $blog_link;
}

// Output:
echo $blog_list_start;
echo implode( $blog_list_separator, $blog_links );
echo $blog_list_end;

if ( $blog_list_as_list )
{
	echo
	'</select>'.
	'<input type="submit" value="Go" />'.
	'</form>';
}

/*
 nolog */
?>

Then just have $blog_list_as_list as true.

6 Sep 13, 2006 21:41

sorry for being really stupid, but where do I set that?

In my template I just have

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

to display the bloglist.

Right now its just shows a bulleted list with the new _bloglist.php

7 Sep 14, 2006 00:15

Yeh so replace your skin's _bloglist.php with the one i posted above, and change;

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


to

$blog_list_as_list = true;
require( dirname(__FILE__).'/_bloglist.php' );

8 Sep 14, 2006 10:17

Wow now it work! Thanks a lot!

One small error though: it does not work with subdomains. I guess because it call the blogs via index.php?blog=X

Stubfiles does not work either (but you are still able to call the blog - with the subs I get 404 error).

9 Sep 14, 2006 10:20

I guess because it call the blogs via index.php?blog=X

Yeh.

I would need to figure out how stubfiles or the subdomains work to do that. Maybe someone else has the know how...

10 Sep 14, 2006 12:56

another way to do it :

I made a _dropdownbloglist.php

<FORM>
<SELECT NAME="bloglist" onchange=window.location=this.options[selectedIndex].value>
<?php
for( $curr_blog_ID = blog_list_start();
			$curr_blog_ID != false;
			 $curr_blog_ID = blog_list_next() )
{
	if( !blog_list_iteminfo( 'in_bloglist', false ) )
	{ // don't show
		continue;
	}
	if( $curr_blog_ID == $blog )
	{ // This is the blog being displayed on this page:
		echo '<option value="';
		blog_list_iteminfo('blogurl', 'raw');
		echo '" selected="selected">'; 
		blog_list_iteminfo('shortname', 'htmlbody');
		echo '</option>';
	}
	else
	{ // This is another blog:
		echo '<option value="';
		blog_list_iteminfo('blogurl', 'raw');
		echo '">';
		blog_list_iteminfo('shortname', 'htmlbody');
		echo '</option>';
	} // End of testing which blog is being displayed
}
?>
	</SELECT>
</FORM>

and on the place i wanted that :
<?php require( dirname(__FILE__).'/_dropdownbloglist.php' ); ?>

11 Sep 14, 2006 13:36

thanks all! The last solution worked well! Now it also works with stubs and subdirs!

Thanks for all the help! :D


Form is loading...