| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
talluri
Joined: 23 Nov 2006 Posts: 8
|
Posted: Wed Dec 06, 2006 11:42 am Post subject: highlighting the keywords |
|
|
Hi,
As google search ,when we are entering some text in the google search box,some result will come.In that results if any keywords are matched with our text ,those keywords will be highlighted,I want code for that.In our application we are putting that one.Since two days I am trying for that.I dont have much knowledge in regular expressions.Can any one help me in this issue.It's very urgent to me.This is we are going to implement in forum itselft.While posting only I am checking for some keywords,if keywords matches only I am posting that one.So when we are seeing that topic that keywords should be highlighted.
Thanks,
Talluri.  |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15131
|
|
| Back to top |
|
 |
talluri
Joined: 23 Nov 2006 Posts: 8
|
Posted: Wed Dec 06, 2006 1:26 pm Post subject: highlighting keywords |
|
|
Hi,
In our application we used phpbb only.In this we are having four categories.For each castegory we used some keywords,for tracking the post.Suppose the categories are
1.Romance
2.Classifieds
3.Jobs
4.Events
Suppose ,the user want to post one topic in romance,but instead he posted in classifieds,In that case we have to track that post based on some keywords(which are already in a data base) and we have to post in correct category.
When we are viewing that topic that kewords should be highlighted.
Regards,
Talluri |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 15131
|
Posted: Wed Dec 06, 2006 1:46 pm Post subject: Re: highlighting the keywords |
|
|
But in case a user did not post in the correct forum, you can just move the topic, it won't change its URL, and will make it easier for user to browse the forums.
About the highlights, if this is correct, you want to highlight some of the post content.
So, this is rather easy, try these links :
http://phpbb2.phpbb-seo.net/phpbb-seo-demo-modules-list-vt84.html?highlight=phpBB
http://phpbb2.phpbb-seo.net/phpbb-seo-demo-modules-list-vt84.html?highlight=phpBB+SEO
The vanilla url would be :
http://phpbb2.phpbb-seo.net/viewtopic.php?t=84&highlight=phpBB+SEO
The highlight words are grabbed in viewtopic.php :
| Code: |
//
// Was a highlight request part of the URI?
//
$highlight_match = $highlight = '';
if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars($HTTP_GET_VARS['highlight'])));
for($i = 0; $i < sizeof($words); $i++)
{
if (trim($words[$i]) != '')
{
$highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', preg_quote($words[$i], '#'));
}
}
unset($words);
$highlight = urlencode($HTTP_GET_VARS['highlight']);
$highlight_match = phpbb_rtrim($highlight_match, "\\");
}
|
As you can see, it's only waiting for GET vars, but you could easily add a check on post vars and get the highlights you want transmitted through POST var instead, sent from where the topic or post is linked, (since it seems you want to chooses them, the user does not need to see them in URL), so that you won't end up with any duplicates.
++ |
_________________ 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 |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |