Recent Topics

1 Nov 26, 2005 07:23    

The search box contained in most skins seems to search the entire URL (all blogs) is there a way to search only the current blog.

<div class="bSideItem">
<h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
<form name="SearchForm" method="get" class="search" action="<?php $Blog->disp( 'blogurl', 'raw' ) ?>">
<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>
<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>
<br />
<input type="submit" name="submit" value="<?php echo T_('Search') ?>" />
<input type="reset" value="<?php echo T_('Reset form') ?>" />
</form>
</div>

2 Nov 26, 2005 07:37

Are you searching from blog #1? Based on a couple of older threads, people want to make it search all blogs instead of just the current one. The solution is to trick b2evolution into thinking it's on blog #1, so if you're on blog #1 you get what you got.

3 Nov 26, 2005 09:41

No I'm not searching Blog 1

I'm interested in the search mechanism (code above is example from skin I have) searching the Blog the user is currently on when they execute the search so if it's Blog 8 the search is on Blog 8 if Blog 4, Blog 4 etc...

Thanks,

4 Nov 26, 2005 11:47

Got link where we can see this problem?

The code you pasted should search the blog you're on. $Blog->disp( 'blogurl', 'raw' ) identifies one specific blog - not the whole database.

EDIT: are you using clean permalinks or not? For some reason I think it might matter.

6 Nov 26, 2005 16:23


<div class="bSideItem">
<h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
<form name="SearchForm" method="get" class="search" action="./">
<div>
<input type="hidden" name="blog" value="<?php echo $Blog->ID; ?>" />
<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>
<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>
<br />
<input type="submit" name="submit" value="<?php echo T_('Search') ?>" />
<input type="reset" value="<?php echo T_('Reset form') ?>" />
</div>
</form>
</div>

¥

7 Nov 30, 2005 16:54

I've got the same question, but in the other direction. When I do a search it only shows results from the blog on which the search was run. I want it to show results from all the blogs. I think somewhere along the way I changed it to show only the current blog, but I can't recall what/where the change was.

This is the search block I'm using, if it'll help:

<div class="righttext">

<h3 class="sideItemTitle"><?php echo T_('Search') ?></h3>
<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', '', 'get', 'SearchForm' ) ?>
<p>
<input type="text" name="s" size="25" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" /><br />
<input type="radio" name="sentence" value="AND" id="sentAND" <?php if( $sentence=='AND' ) echo 'checked="checked" ' ?>/>&nbsp;<?php echo T_('All Words') ?><br />
<input type="radio" name="sentence" value="OR" id="sentOR" <?php if( $sentence=='OR' ) echo 'checked="checked" ' ?>/>&nbsp;<?php echo T_('Some Word') ?><br />
<input type="radio" name="sentence" value="sentence" id="sentence" <?php if( $sentence=='sentence' ) echo 'checked="checked" ' ?>/>&nbsp;<?php echo T_('Entire phrase') ?><br />
<input type="submit" name="submit" class="SubmitButton" value="<?php echo T_('Search') ?>" /> 
</p>
</form>

</div>

jj.

8 Nov 30, 2005 17:06

BTW - I implemented the code suggest by YABBA and it errored.

NOTE: I had to remove the search from this portal for deployment (due to this issue), will setup a testing area and provide another link.

(sorry for the late response)

9 Dec 02, 2005 21:18

EdB wrote:

Got link where we can see this problem?

The code you pasted should search the blog you're on. $Blog->disp( 'blogurl', 'raw' ) identifies one specific blog - not the whole database.

EDIT: are you using clean permalinks or not? For some reason I think it might matter.

EdB, if that code identifies one specific blog, what's the syntax for searching the entire database?

jj.

10 Dec 02, 2005 22:12

Ooops, sorry, I posted that code untested, try changing $Blog->ID to $blog and see if that cures it.

¥

11 Dec 02, 2005 23:18

ok, I seem to have had the trouble I was mentioning only on the search mechanism on one skin and sadly it was one I'd stuffed around with. I located anohter skin 'custom' that had search implemented and that now works and only searchs the Blog you are on.

Is there an answer to jibberjab's question about always searching all blogs and a setting for that. That's an interesting idea.


Form is loading...