Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('core.php');
- closed();
- include(INC.'class/create.php');//Klasa do obsługi szablonów
- $template = new template;
- if(!empty($_GET['id'])){
- $id = (int)$_GET['id'];
- $result = mysql_query("SELECT * FROM `news` WHERE `nid` = $id") or error();
- if(mysql_num_rows($result) > 0){
- $row = mysql_fetch_array($result);
- //Dodawanie do zmiennych w szablonie różnych informacji
- $template->nid = $row['nid'];
- $template->title = $row['title'];
- $template->photo = $row['photo'];
- $template->date = $row['date'];
- $template->moretext = $row['moretext'];
- $template->reads = $row['reads'];
- $template->visible = $row['visible'];
- $template->pagetitle = 'News #'.$row['nid'];
- $template->load('news_id.php'); //Ładowanie pliku który ma być wyświetlony
- }
- else{
- $template->pagetitle = 'Nie istnieje taki news!';
- $template->load('no_result.php');
- $template->title = 'Nie istnieje taki news!';
- }
- }
- else{
- $query = "SELECT * FROM `news` order by `date` DESC";
- $result = mysql_query($query) or error();
- if(mysql_num_rows($result) > 0){
- $content = '';
- while($row = mysql_fetch_array($result))
- {
- $date = date('d/m/Y', strtotime($row['date']));
- $content .= '<div class="article">
- <img src="'.NEWS_IMAGES_MINI_WWW.$row['photo'].'" alt="'.$row['nid'].'" />
- <h3>'.$row['title'].'</h3>
- <h4>'.$date.'</h4>
- '.$row['text'].'
- <div class="readmore"><a href="'.WWW.'news.php?id='.$row['nid'].'">Czytaj dalej</a></div>
- </div>';
- }
- $template->load('news.php');
- $template->pagetitle = 'News';
- $template->news = $content;
- }
- else{
- $template->pagetitle = 'News';
- $template->load('news.php');
- $template->news = '<center><h2>Brak newsów<h2/></center>';
- }
- }
- $template->display(); //Wyświetlenie strony
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement