phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Search Highlight PHPBB problem after mod rewrite

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
::  
Author Message
sceltic
PR0
PR0


Joined: 04 May 2006
Posts: 55

Search Highlight PHPBB problem after mod rewritePosted: 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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14327

Search Highlight PHPBB problem after mod rewritePosted: 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 :

Code:
Search.php

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'] . "&amp;highlight=$highlight_active");
         $post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id'] . "&amp;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 Wink And there is Still the good old CTRL+F to highlight search terms Wink

++

_________________
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
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
Page 1 of 1

Navigation Similar Topics

Jump to: