Recent Topics

1 Feb 13, 2007 05:48    

How about making a mainline b2evolution change to add a BackOffice boolean option for each blog that indicates whether the search bar for the given blog is to search (a) the current blog, or (b) all accessible blogs? By accessible I mean the blogs that the viewer has access to according to how she's currently logged in.

I'm planning to set up my site so that my home page is blog 1 or 2, and other blogs correspond to different areas or articles within the site. In this kind of setup one definitely wants at least some searches to search the entire site (all blogs). I've seen other people in these forums ask how to set up their site similarly - probably making searches configurable in this way would be of general interest.

This would be something that would continue to work in future versions because it would allow blog owners to avoid having to hack the core PHP files in order to get this functionality, e.g., as discussed here: http://forums.b2evolution.net//viewtopic.php?p=51111#51111

2 Feb 14, 2007 11:15

<div class="bSideItem">
		<h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
		<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ) ?>
			<p><input type="text" name="s" size="30" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" /><br />
			<input type="radio" name="sentence" value="AND" id="sentAND" <?php if( $sentence=='AND' ) echo 'checked="checked" ' ?>/><label for="sentAND"><?php echo T_('All Words') ?></label><br />
			<input type="radio" name="sentence" value="OR" id="sentOR" <?php if( $sentence=='OR' ) echo 'checked="checked" ' ?>/><label for="sentOR"><?php echo T_('Some Word') ?></label><br />
			<input type="radio" name="sentence" value="sentence" id="sentence" <?php if( $sentence=='sentence' ) echo 'checked="checked" ' ?>/><label for="sentence"><?php echo T_('Entire phrase') ?></label></p>
			<p><input type="checkbox" name="blog" value="1" id="all_blogs" /><label for="all_blogs">Search all blogs</label></p>
			<input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
		</form>
	</div>

¥

3 Feb 14, 2007 20:37

Thanks. If I understand the idea, that isn't quite what I'm looking for. Maybe I need to expand a little. I'm looking for a way to have the default search method (current blog or all accessible blogs) be automatically set by the host. The default isn't something that would be user-configurable. For example, on a web site where the main portal page is a b2evolution blog, one would usually want searching to search the whole web site (all blogs), not just the main page. The user could choose to override this if they wanted. However in particular blogs one might want searching just to search that blog, e.g., when the blog is essentially one large article. These defaults are particular to the blog - they are not particular to users or skins. If one changes skins, the search method default should continue to be the same. For example if one views the main web site portal page in a different skin, this should not affect whether the entire is searched from the search box on the main portal page.

Sorry if I am not understanding what you suggested - there aren't any words to go with the code and I am not a b2evolution expert.


Form is loading...