|
07-30-2005, 10:55 PM | #1 |
Green Mole
Join Date: Jul 2005
Posts: 2
|
Restricting search results by URL at the search form level
I know that this has been talked about a few times in the forum, and I have read through all posts, but know body has asked this specific question as far as I can tell. My site is broken up by different languages via sub-directories, for example, es.mysite.com and de.mysite.com. However, my search results once all domains are spidered are mixed. So, from each language area I want to restrict results to that sub-domain (which phpdig treats as a unique URL, which I like, thus making this much more easy). What is the code to simply add this variable into the form? I don't want the form on en.mysite.com to show results for anything other than en.mysite.com. I don't need any option buttons, just need to know how to pass the restriction along to the rest of the program (my php skills suck).
|
07-31-2005, 08:58 AM | #2 |
Head Mole
Join Date: May 2003
Posts: 2,539
|
Try the following...
In search.php find: Code:
if (ALLOW_RSS_FEED) { Code:
if (!empty($_SERVER['HTTP_HOST']) && (empty($site) || $path == '-###-')) { if (empty($site)) { $temp_site = addslashes("http://".$_SERVER['HTTP_HOST']."/"); $temp_query = mysql_query("SELECT site_id FROM ".PHPDIG_DB_PREFIX."sites ". "WHERE site_url = '$temp_site' LIMIT 1",$id_connect); $temp_row = mysql_fetch_row($temp_query); $site = $temp_row[0]; } $path = ''; }
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension. |
07-31-2005, 07:11 PM | #3 |
Green Mole
Join Date: Jul 2005
Posts: 2
|
That almost worked. Now when I search from either
es.symptoms101.com or www.symptoms101.com the results are only being shown from www.symptoms101.com (english). Eventually this site will have Spanish, German, Italian, French, and maybe portuguese, so begin able to keep the sub domain results separate would be great when searching from the sub domain itself. So, the results of the above change are that all results are being shown in english, sourcing from www.symptoms101.com (which is where the search program is located). A more confusing twist, and I don't understand the technicality of it, may be that the system is creating subdomains by making folders within www.symptoms101.com for example, es.symptoms101.com is located on the server at www.symptoms101.com/es/. That is why I was asking about specifying the "sub domain" via the form. Any ideas on how to make it work? The site is set up now with the two subdomains and the search is coded with your suggested changes (99.9% of my traffic is english speaking until the rest of the site gets spidered, probably in a week or so). P.S. Love the smileys on this forum! |
08-01-2005, 08:36 AM | #4 |
Head Mole
Join Date: May 2003
Posts: 2,539
|
Set a PHP info page in the es subdirectory:
Code:
<?php phpinfo(); ?> The code above was to attempt to get the correct site_id depending on what (sub)domain the user entered prior to searching, without having to change the HTML form on each page. You might try using the following in the HTML form instead: Code:
<input type='hidden' name='site' value='XX'/> <input type='hidden' name='path' value=''/> <input type='hidden' name='refine' value='1'/> You might may to tweak the HTML like so: Code:
<input type='hidden' name='site' value='XX'/> <input type='hidden' name='path' value='es/'/> <input type='hidden' name='refine' value='1'/>
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search form | Anton | How-to Forum | 0 | 11-15-2006 10:42 PM |
search form 'remembering' previous search | lukemack | How-to Forum | 0 | 12-16-2005 04:10 AM |
Problem restricting search results | Grenville Hamly | How-to Forum | 6 | 10-14-2004 05:19 PM |
search form sites | guskoul | Troubleshooting | 7 | 08-03-2004 12:55 PM |
separting results and search form | nicedream | How-to Forum | 2 | 12-08-2003 01:49 PM |