Author |
Message |
hinksta
Worker


Joined: Dec 23, 2005
Posts: 226
Location: UK
|
Posted:
Thu Nov 30, 2006 7:37 am |
|
I'm trying to GT a database search module i've made but having problems with the GT'd serch results when it has multipule search words.
modules.php\?name=MySearch&search=([a-zA-Z]*)&page=([0-9]*)
football_news_\\1_page-\\2.html
The first parameter is the search words and works fine with one word but if I have more than one search word I get
football_news.html?search=WORD1%20WORD2&page=2
the original url looks like search=WORD1 WORD2 so I think it's the space but can't figure it out. |
|
|
|
 |
hinksta

|
Posted:
Thu Nov 30, 2006 7:50 pm |
|
If I put a space after the Z
modules.php\?name=MySearch&search=([a-zA-Z0-9 ]*)&page=([0-9]*)
I get
football_news_WORD1%20WORD2_page-2.html
Is there a way to replace the %20 with a space? |
Last edited by hinksta on Fri Dec 01, 2006 5:36 am; edited 1 time in total |
|
|
 |
evaders99
Former Moderator in Good Standing

Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Thu Nov 30, 2006 11:19 pm |
|
%20 is a space character. Are you saying its not working as a space? |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
 |
hinksta

|
Posted:
Fri Dec 01, 2006 5:34 am |
|
evaders99 wrote: | %20 is a space character. Are you saying its not working as a space? |
Yes, maybe I'm not writing the htaccess corectly
RewriteRule ^football_news_([a-zA-Z0-9]*)_page-([0-9]*).html modules.php?name=MySearch&search=$1&page=$2 [L]
I saw in a post by Audioslaved that you should use % , something like ([a-zA-Z0-9%]*) to sort the space but that's not making any difference. |
|
|
|
 |
hinksta

|
Posted:
Fri Dec 01, 2006 7:27 pm |
|
fixed it with $search = str_replace(" ", "-", $search); |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Dec 02, 2006 10:20 am |
|
I would try using the exact same regex that you used in the GT file. Did the following really not work?:
RewriteRule ^football_news_([a-zA-Z0-9 ]*)_page-([0-9]*).html modules.php?name=MySearch&search=$1&page=$2 [L]
Notice the space after the 9. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
hinksta

|
Posted:
Sat Dec 02, 2006 10:39 am |
|
No it would not work, but the fix works well, had to do the oposite fix for the $keywords so that pagelinks would work.
It's a cool little module that searches the multiheadlines database allowing me to make perminent gt'd links with dynamic titles using search terms. |
|
|
|
 |
montego

|
Posted:
Sat Dec 02, 2006 10:46 am |
|
that is strange. I could have sworn that I've seen this working (not with your specific module, but the concept). If I get time, I'll check this on one of my sites. |
|
|
|
 |
|