Norik
Active Member
کسی ميتونه اين تيکه رو به asp ترجمه بکنه؟ :roll:
http://www.omlettesoft.com/showsource.php3?file=/home/a1/omlettesoft.com/.WWW/index.php3 :arrow:
کلماتی رو که تو گوگل search کردين highlight ميبينين.
کد:
/****************************************************************************/
//Dean Allen
//textism.com
function google_hilite ($text, &$smarty)
{
$ref = urldecode ($_SERVER['HTTP_REFERER']);
# let's see if the referrer is google
if (preg_match('/^http:\/\/w?w?w?\.?google.*/i',$ref))
{
# if so, tweezer out the search query
$query = preg_replace('/^.*q=([^&]+)&?.*$/i','$1',$ref);
# scrub away nasty quote marks
$query = preg_replace('/\'|"/','',$query);
# chop the search terms into an array
$query_array = preg_split ("/[\s,\+\.]+/",$query);
# loop through the search terms
foreach($query_array as $b)
{
if (!preg_match('/<.+>/',$text))
{
# If there are no tags in the text, we'll just do a simple search and replace
$text = preg_replace('/(\b'.$b.'\b)/i','<span class="hilite">$1</span>',$text);
}
else
{
# If there are tags, we need to stay outside them
$text = preg_replace('/(?<=>)([^<]+)?(\b'.$b.'\b)/i','$1<span class="hilite">$2</span>',$text);
}
}
}
return $text;
}
/****************************************************************************/
http://www.omlettesoft.com/showsource.php3?file=/home/a1/omlettesoft.com/.WWW/index.php3 :arrow:
کلماتی رو که تو گوگل search کردين highlight ميبينين.