Recent Topics

1 Feb 26, 2006 10:06    

I'm setting up a series of Village websites each one made up of 3 or 4 blogs. Is there anyway I can make the search function search all the blogs that make up the website. I don't want to search ALL blogs I want to search specific blogs.

here's what I'm using in each blog at present

<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ) ?>
			<p><input type="text" name="s" size="15" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" />  <input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
		</form>

2 Feb 26, 2006 19:13

Ok, this is totaly "off the top of my head", so if it's wrong .... hell at least I tried :p

You "appear" to be able to restrict the cats to any group you want with $cat and $catsel, so, you could have a search "stub" file that sets $blog=1 and $cat (or $catsel) to the list of cats within the blogs you want to search (you could have diferent search "stubs" for different blogs), ie :
$blog = 1;
$catsel = array( 1,27,14 ); // cats for blogs # and #

This would require that you manually set cats for each search stub (although you can probably automate that part of the process)

¥

3 Apr 09, 2006 03:06

stevet wrote:

I'm setting up a series of Village websites each one made up of 3 or 4 blogs. Is there anyway I can make the search function search all the blogs that make up the website. I don't want to search ALL blogs I want to search specific blogs.

here's what I'm using in each blog at present

<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ) ?>
			<p><input type="text" name="s" size="15" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" />  <input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
		</form>

I'm actually trying to search across every blog I have.. would you know how to do this? Similar to above I assume?

4 Apr 10, 2006 08:58

add :-
<input type="hidden" name="blog" value="1" />

to your form, and it'll search all blogs ;)

¥

5 Apr 11, 2006 06:25

¥åßßå wrote:

add :-
<input type="hidden" name="blog" value="1" />

to your form, and it'll search all blogs ;)

¥

This is the current code in the skin... where do I add what you wrote? Sorry. I replace the bottom code with yours and it just delete the search button.

<input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />

6 Apr 11, 2006 11:51

You need to add that extra code anywhere in your search form code (between the <form></form> tags).

¥

7 Apr 12, 2006 01:05

¥åßßå wrote:

You need to add that extra code anywhere in your search form code (between the <form></form> tags).

¥

Can you show me specifically with the code from my previous post? Its not working.

8 Apr 12, 2006 10:58

Your search from should look similar to this


<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>

			<input type="hidden" name="blog" value="1" />

			<input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
		</form>
	</div>

¥

9 Apr 12, 2006 16:47

¥åßßå wrote:

Your search from should look similar to this


<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>

			<input type="hidden" name="blog" value="1" />

			<input type="submit" name="submit" class="submit" value="<?php echo T_('Search') ?>" />
		</form>
	</div>

¥

Thanks this worked.. I had placed it in the wrong place before!

11 Mar 11, 2007 17:08

I have used this code from ¥åßßå... to have my search mechanism search multiple blogs. It is a very excellent modification that "calls" the blog #1 (Blog All), and only shows search results (from every post in all the blogs). I even used a different skin I modified just for the "Blog All" so that my search results have a customized look from the rest of the blogs.

But I found that when I created stub files, this wonderful tool no longer works.

In other words this will only work if the blog you are utilizing the blog url as,

index.php?blog=7

The search modification described by ¥åßßå appends to that url to read

index.php?blog=7?s=test&word=AND&blog=1&submit=Search

It then calls the blog 1, "Blog All", with just the search results, showing with the new skin (if you have one for that Blog #1).

But, if the blog where I execute the Search multiple blogs, using the code addition:

 <input type="hidden" name="blog" value="1" /> 

is a stub file (such as myspecialblog.php) then the searching multiple blogs is nullified, because even though it attempts to append it looks like this:

/myspecialblog.php?s=test&sentence=AND&blog=1&submit=Search

and that will only search the current blog (and skin stays the same).

My question:
Is there any way to effect the search in multiple blogs (calling the "All blogs" blog) from a blog that has been loaded from a stub file url? I like to use the stub file approach (creates a nice looking url), but I don't want to give up searching through all the blogs. Is there a way to have both stub files and multiple blog searches?

12 Mar 11, 2007 19:59

I have a hack that seems to do the job just fine. (maybe it is not very orthodox)

In the _main.php I modified this


<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), '', 'SearchForm' ) ?>


to


<?php form_formstart( 'http://www.your_site.com/index.php/all', '', 'SearchForm' ) ?>


this way it fools the system into thinking the search request is sent by the blog all.
This works for all the blogs.

I modified the blog All to show the search string (or the author)

have a look in "ARCH" here (ORG and EDU are joomla)
http://www.avbr.nl/blog/arch.php

13 Mar 11, 2007 22:51

Great solution (but, for me it required a minor modification).

First, I saw that it works great on your site. I searched for the word "studenten." (I think that's the Dutch word for student.)

And this is the url which showed in the browser window:

http://www.avbr.nl/blog/index.php/all?s=Studenten&submit.x=11&submit.y=9

Plus, on your site, the results were exactly what I was seeking.

But, I when tried the code you suggested on mine, I couldn't get it to work (even though my, blog #1, has been designated with a url blog name of "all" in the b2 backoffice). It just does the "page not found" thing. It would be nice to know how you got it to work with the "all" designation, but, I went with your idea, realizing it would work to achieve my stub file hopes (as I stated in my earlier post).

I still followed your example of fooling it into thinking the request was coming from blog 1. First, I did a stub file for my "blogs all" (also called blog 1) and called it "searchresults.php." Then, I did the code change (where you described it should go) like this:

<?php form_formstart( 'http://www.mywebsite.com/searchresults.php?', '', 'SearchForm' ) ?>

It worked! It fooled it into thinking the search was coming from my stub file searchresults.php, even though it was from other specially named php stub files (like "peaceandharmony.php" and "saferplanet.php") just as I hoped for. The search called my specially skinned "blogs all" (now known as "searchresults.php") showing the desired search results.

Success!! That was a great tip. Thanks.

Sam


Form is loading...