Recent Topics

1 Mar 29, 2006 01:24    

Hi Gang,

Sorry if this has been answered elsewhere, I did a search but couldn't find anything.

Has anyone created an "advanced search" page where you can select the categories you'd like to search in and then click search? Specifically, has this been done outside the blog? (On a non-b2e page?)

Thanks, as always, for your incredible help. I'm always amazed at the thoroughness of the group on this forum!

Dan

2 May 07, 2008 05:41

sorry for bumping this ancient post..
but this is exactly what i am looking for right now.. any idea ? :roll:

3 May 07, 2008 06:02

You can add &cat=2 as a search parameter and it will display results from the second category only.

So you can build a drop down menu with categories and set category ID as a value. You can use categories widget to build this menu.

There might be another way, let's wait for devs...

4 May 07, 2008 09:38

Open inc/widgets/widgets/_coll_search_form_widget.php and use this function to display the search form.
You still have to style categories select fieldset with css, I have no idea how to get rid of it.

function display( $params )
{
	global $Blog;

	$this->init_display( $params );

	// Collection search form:
	echo $this->disp_params['block_start'];

	$Form = & new Form( NULL, 'form' );
	$this->disp_title( T_('Search') );

	form_formstart( $Blog->gen_blogurl(), 'search', 'SearchForm' );
	
	echo '<br />';
	$s = get_param( 's' );
	echo '<input type="text" name="s" size="25" value="'.htmlspecialchars($s).'" class="SearchField" /><br />';
	
	// Category select
	$ChapterCache = & get_Cache( 'ChapterCache' );
	$Form->select_input_options( 'cat', $ChapterCache->recurse_select( NULL, $Blog->ID, true, NULL, 1 ), T_('Select category') );
	
	echo '<p>';
	$sentence = get_param( 'sentence' );
	echo '<input type="radio" name="sentence" value="AND" id="sentAND" '.( $sentence=='AND' ? 'checked="checked" ' : '' ).'/><label for="sentAND">'.T_('All Words').'</label><br />';
	echo '<input type="radio" name="sentence" value="OR" id="sentOR" '.( $sentence=='OR' ? 'checked="checked" ' : '' ).'/><label for="sentOR">'.T_('Some Word').'</label><br />';
	echo '<input type="radio" name="sentence" value="sentence" id="sentence" '.( $sentence=='sentence' ? 'checked="checked" ' : '' ).'/><label for="sentence">'.T_('Entire phrase').'</label>';
	echo '</p>';
	echo '<input type="submit" name="submit" class="submit" value="'.T_('Search').'" class="search_submit" />';
	echo '</form>';

	echo $this->disp_params['block_end'];

	return true;
}

5 May 07, 2008 15:36

thank you very much sam2kb, i am pretty sure it would work; but on second thought, that was not what i needed (:, i ve created a blog for each category, like 15 blogs for 15 categories, so ; what i need is a search form, among blogs not categories ..

6 May 07, 2008 17:58

This is much easier. Just create another blog, set it to aggregate all others and hardcode blog id in search widget.

7 May 07, 2008 18:06

sam2kb wrote:

This is much easier. Just create another blog, set it to aggregate all others and hardcode blog id in search widget.

actually i dont know if i am doing this right, but i am using Blog#1 for main blog to include all the other category-blogs, and am cross-posting in to Blog#1 using the other cat-blog's cats instead of aggregating..

so that i am able to actually include all posts under 1 blog instead of aggregating in order to be able to do different things, (for example, i did add a post_list widg. in the sidebar and made it 'random select' from 'blog1' and there you go 'a global random post widget for all blogs' (: )

i dont know if this is right, i hope crossposting as 2 wont hurt in future in perm urls etc..

thank you sam2kb, i guess as i already have blog1 to include all the other posts; i will just hardcode blog1 and will be able to search all content in a way..

i am just trying to figure out making an advanced search page lets say just for Blog#7 and blog#11 with being selected from checkboxes.. sounded hard to me but will try..cheers


Form is loading...