wiem co jest zle a nie wiem jak naprawic :/
class theme {
var $top;
var $theme;
var $plik;
function theme($plik) {
if(file_exists($plik)){
$f = fopen($plik, 'r');
$this -> theme = fread($f, filesize($plik));
fclose($f);
}else{ echo 'Blad wczytania templatki'; }
}
function load($top) {
global $theme, $folder, $adres, $nazwa;
$this->top=$top;
$this->theme = ereg_replace( '{title}', $nazwa, $this->theme );
$this->theme = str_replace( '{lewe}', 'lewe', $this->theme );
$this->theme = str_replace( '{top}', $this->top, $this->theme );
$this->theme = str_replace( '{prawe}', 'right', $this->theme );
$this->theme = str_replace( '{adres}', $adres.'/', $this->theme );
$this->theme = str_replace( '{folder}', $folder, $this->theme );
//$theme= ereg_replace( '{blok_usera}', blok_user(), $theme );
$theme='?>'.$this->theme.'<?';
echo eval($theme);
}
}
,_moja klasa ale jak mam plik:
<?php
$page=$link[1];
$lim = $config['news_limit'];
$sql = "SELECT COUNT(*) FROM {$prefix}news WHERE jaki='1' ORDER BY id";
$ile = $db->result($db->query($sql),0);
$limit = $page * $lim;
$sa = "SELECT * FROM {$prefix}news WHERE jaki='1' ORDER BY id DESC LIMIT $limit, $lim";
$result = $db->query($sa);
$il = $db->num_rows($result);
$query1 = "SELECT * FROM {$prefix}sources";
$result1 = $db->query($query1);
while($r3 = $db->fetch_array($result1)) {
$source[$r3['id']]='<a href="'.$r3['linka'].'" target="_blank">'.$r3['linkb'].'</a>';
}
while($r = $db->fetch_array($result)) {
$text = make_clickable($r['text']);
$text = bbcode($text, 1);
$text = smilies($text);
$data_format = date($config[data
], $r['date']);
if($source[$r['source']]!='') {
$sources='Żródło: '.$source[$r['source']];
} else { $sources=''; }
news($r['author'], $data_format, $sources, $text, $r['id'], $r['comm'], $r['title']);
}
echo '<div class="tekst">Strony:<br>'; $row = (int) $ile;
$ile = $ile / $lim;
if($page==''){$page=0;}
if($ile<>'1'){
$odnosnik = '';
if($page>'0'){echo '[<a href="'.$odnosnik.''.($page-1).'">poprzednia</a>]';} if($page>='4'){echo '[<a href="'.$odnosnik.'0">1</a>]...';} if($page>'2'){echo '[<a href="'.$odnosnik.''.($page-3).'">'.($page-2).'</a>]';} if($page>'1'){echo '[<a href="'.$odnosnik.''.($page-2).'">'.($page-1).'</a>]';} if($page>'0'){echo '[<a href="'.$odnosnik.''.($page-1).'">'.$page.'</a>]';} echo '[<font color="red"><b>'.($page+1).'</b></font>]'; if($page<($ile-1
)){echo '[<a href="'.$odnosnik.''.($page+1).'">'.($page+2).'</a>]';} if($page<($ile-2
)){echo '[<a href="'.$odnosnik.''.($page+2).'">'.($page+3).'</a>]';} if($page<($ile-3
)){echo '[<a href="'.$odnosnik.''.($page+3).'">'.($page+4).'</a>]';} if($page<($ile-4
)){echo '...[<a href="'.$odnosnik.''.($ile-1).'">'.$ile.'</a>]';} if($page<($ile-1
)){echo '[<a href="'.$odnosnik.''.($page+1).'">nastepna</a>]';} }else{echo '[<b>1</b>]';} echo '</div></br></font>';
?>
to usuwa wszytskie przed i z $db-> :/ macie pomysly?