Plik robiący filtracje
<?php class show { function show() { $this->emot = &$GLOBALS['table']['emot']; } function emot() { if($re['emot'] == '-') return false; if($re['emot'] == '+') return true; } function k_news($ret, $r, $kom, $text) { #if(show::emot() == true) show::str_emot($r); $ret = str_replace('{news:pirint}', '<a href=\"print.php?a=news&id='.$r['id'].'\"><img src=\"theme/news/gxf/print.gif\" alt=\"\" border=\"0\" /></a>', $ret); $ret = str_replace('{news:kom}', '<a href=\"news.php?a=kom&id='.$r['id'].'\">'.$text['kom'].' ('.$kom.')</a>', $ret); if($r['dtext'] != '') { $ret = str_replace('{news:stext}', '<a href=\"news.php?a=show&id='.$r['id'].'\">'.$text['more'].'', $ret); } // if return $ret; } // function } // class ?>
Plik który ma być przefiltorwany
Natomiast Plik wyświetlający:
<?php class news { function news() { $this->news = &$GLOBALS['table']['news']; $this->limit = &$GLOBALS['table']['limit']; $this->kom = &$GLOBALS['table']['kom']; } // function function limit() { $limit = $rr['ile']; return $limit; } // function function show() { $limit = news::limit(); include_once('news_lib/news_str.lib.php'); if ($page < 1 || $page > $pages) { $page = 1; } // if $result = mysql_query(\"SELECT * FROM {$this->news} WHERE act='1' ORDER BY id DESC LIMIT {$limit} OFFSET \".(($page-1)*$limit)); { } } // function } // class ?>