$length)
return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer;
return $string;
}
$dir = 'content'; //adres katalogu
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false ) {
if (($file != ".") && ($file != ".."))
$coo[] = $file;
}
closedir($dh);
}
}
foreach($coo as $key => $val)
{
$coo[$key]=explode('.', $val);
$linki .= '
'.ucfirst($coo[$key][0]).'';
}
$generate=file_get_contents($szablon);
if(file_exists('content/'.urldecode(str_replace("-", " ", $_GET['fname'])).'.txt') AND $_GET['fname'] != '')
{
$content=file_get_contents('content/'.urldecode(str_replace("-", " ", $_GET['fname'])).'.txt');
$title=ucfirst(urldecode(str_replace("-", " ", $_GET['fname'])));
$href=urlencode($_GET['fname']).'.html';
}
else
{
$href='';
$title='Wyceny nieruchomosci - Warszawa';
$content=@file_get_contents('content/index.txt');
}
$description=textLimit($content, 200);
$zamien = array("{CONTENT}" => $content, "{TITLE}" => $title, "{DESCRIPTION}" => $description, "{HREF}" => $href, "{LINKI}" => $linki, "{STAT1}" => $statlink_link['0'], "{STAT2}" => $statlink_link['1'], "{STAT3}" => $statlink_link['2'], "{STAT4}" => $statlink_link['3'], "{STAT5}" => $statlink_link['4'], "{STAT6}" => $statlink_link['5'], "{STAT7}" => $statlink_link['6'], "{STAT8}" => $statlink_link['7'], "{STAT9}" => $statlink_link['8'], "{STAT10}" => $statlink_link['9'], "{STAT11}" => $statlink_link['10'], "{STAT12}" => $statlink_link['11'], "{STAT13}" => $statlink_link['12'], "{STAT14}" => $statlink_link['13'], "{STAT15}" => $statlink_link['14']);
echo strtr($generate,$zamien);
?>