#!/usr/bin/perl -w

$zmienna = „mapa,”;
$temp = substr($zmienna, 0, length($zmienna)-1);
print „Polska $temp\n”;


var idx = 0; var idx1 = 0; var idx2 = 0; var cnt = 0;
var city = '';
var url = window.location.href;
idx1=url.lastIndexOf("/");
idx2=url.indexOf("?", idx1);
city = url.substr(idx1, idx2-idx1);
for(i=0; i if(city.charAt(i)=='-') cnt++;
}


Funkcja zwraca wartość parametru q:

function q_in_url(url) {

 var idx = 0;
 var q = ”;
 idx = url.indexOf(‘q=’);
 if(idx!=-1) {
   q = url.substr(idx+2, url.length);
   if(q!=”) {
    return q;
   }
 }
 return ”;
};

Uruchomienie
var url = window.location.href;
var q = q_in_url(url)


$description = iconv(„UTF-8″,”ISO-8859-2″, $description);
$description = substr($description,0, 450);
$pos_cut  = strrpos($description, ‘  ‘);
$description = substr($description, 0, $pos_cut);
$description = wordwrap($description, 55, „<br />\n”);

przycięcie stringa do określonej długości, bez ucinania wyrazu


$html_keywords    = $strona_fragment;
$html_description = substr(str_replace(‘  ‘, ‘ ‘,trim(strip_tags($strona_tresc))), 0, 250);


Załadowanie XML:
$res = file_get_contents($url);Wycięcie fragmentu tekstu:
$content_start  = strpos($res, ‘<content>’) + strlen(‘<content>’);
$head_end       = $content_start;
$content_end    = strpos($res, ‘</content>’);
$foot_start     = strpos($res, ‘</content>’);

$head    = substr($res, 0, $head_end);
$content = substr($res, $content_start, $content_end – $content_start);
$foot    = substr($res, $foot_start);

Konwersja nie zakodowanych znaków:
$content = str_replace(„<”,’<’,$content);
$content = str_replace(„>”,’>’,$content);

$res = $head . $content . $foot;