| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
sceltic PR0

Joined: 04 May 2006 Posts: 55
|
Posted: Tue May 09, 2006 1:15 am Post subject: Search Highlight PHPBB problem after mod rewrite |
|
|
I know that your mod pays attention to this issue
But at present a search resut on user seems to be pushing out urls that do not resolve
this sort of thing
| Code: | | http://www.abc.com/phpbb2/post-4.html&highlight=#4 |
|
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14327
|
Posted: Tue May 09, 2006 7:56 am Post subject: Re: Search Highlight PHPBB problem after mod rewrite |
|
|
hehe, now we have a real bug it seems, finally!
Well in fact not really, more something I forgot to handle, since it was a long time ago I deactivated highlights.
Actually this could be solved once and for all adding a Reg Ex in sessions.php, but I find it more efficient to do it directly in the php files.
The issue only appears when highlight=nothing.
I assume the link you posted here comes from search results so please try this :
Open :
Find :
| Code: | | $highlight_active = urlencode(trim($highlight_active)); |
after add :
| Code: | | $highlight_ok = ($highlight_active !='') ? "&highlight=$highlight_active" : ''; |
Find :
| Code: |
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] . "&highlight=$highlight_active");
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] . "&highlight=$highlight_active") . '#' . $searchset[$i]['post_id']; |
Replace with :
| Code: | $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] . $highlight_ok);
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] . $highlight_ok) . '#' . $searchset[$i]['post_id']; |
This will make sure no empty highlight will be parsed in search results urls.
But you can do as I did here, e.g get rid of the highlights once and for all.
To do so just comment this part of the search.php code :
| Code: | $highlight_active = '';
$highlight_match = array();
for($j = 0; $j < count($split_search); $j++ )
{
$split_word = $split_search[$j];
if ( $split_word != 'and' && $split_word != 'or' && $split_word != 'not' )
{
$highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $split_word) . ')\b#is';
$highlight_active .= " " . $split_word;
for ($k = 0; $k < count($synonym_array); $k++)
{
list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_array[$k])));
if ( $replace_synonym == $split_word )
{
$highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $replace_synonym) . ')\b#is';
$highlight_active .= ' ' . $match_synonym;
}
}
}
}
$highlight_active = urlencode(trim($highlight_active)); |
And change :
| Code: | $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']);
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] . "&highlight=$highlight_active");
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] . "&highlight=$highlight_active") . '#' . $searchset[$i]['post_id']; |
To :
| Code: | $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']);
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] );
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] ) . '#' . $searchset[$i]['post_id']; |
This a bit less user friendly, but in the end you are sure that no highlight duplicates (cause they are) will be posted And there is Still the good old CTRL+F to highlight search terms
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |