if(0 == $page) { $page = 1; } $start = MAXPAGE * ($page - 1); $full = MAXPAGE; while(list($id, $login, $haslo, $mail, $status, $langs, $data, $admin, $oficjalne) = mysql_fetch_row($obej)) { //dany text } if($_GET[page] == '') { $strona = '1'; } else { $strona = $_GET[page]; } $poprzedniastrona = $_GET[page] - 1; if($_GET[page] == '') { $nastepnastrona = '2'; } else { $nastepnastrona = $_GET[page] + 1; } if($total == '0') { } else { echo'<table align="center"> <tr> <td>'; if(($_GET[page] == '1') || ($_GET[page] == '')) { } else { echo'<a href="index.php?event=users&page=1"><input type="submit" value="'.$lang[pierwszastronakatalog].'"></a><a href="index.php?event=users&page='.$poprzedniastrona.'"><input type="submit" value="'.$lang[poprzedniastronakatalog].'"></a>'; } if($strona == $total) { } else { echo'<a href="index.php?event=users&page='.$nastepnastrona.'"><input type="submit" value="'.$lang[nastepnastronakatalog].'"></a><a href="index.php?event=users&page='.$total.'"><input type="submit" value="'.$lang[ostatniastronakatalog].'"></a>'; } echo'</td> </tr> </table>'; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates <a href="http://www.freecsstemplates.org" target="_blank">http://www.freecsstemplates.org</a> Released for free under a Creative Commons Attribution 2.5 License Name : Simple Passage Description: A three-column, fixed-width blog design. Version : 1.0 Released : 20090327 --> <link rel="icon" type="image/png" href="favicon.ico"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>OSP Nadolany</title> <meta name="keywords" content="" /> <meta name="Simple Passage" content="" /> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <div id="header"> <div id="logo"> <h1><span> <div class="header1"><div align="right"><br /> </div></a></h1> </div> <div id="menu"> <ul id="main"> <!-- MENU START --> <?PHP include('include/menu.txt'); ?> <!-- MENU KONIEC --> </ul> </div> </div> <div id="wrapper"> <div id="page"> <div id="page-bgtop"> <div id="page-bgbtm"> <div id="sidebar1" class="sidebar"> <ul> <li> <h2>Menu</h2> <ul> <!-- MENU LEWE START --> <?PHP include('include/menulewe.txt'); ?> <!-- MENU LEWE KONIEC --> </ul> </li> <!-- POGODA START --> <?PHP include('include/pogoda.txt'); ?> <!-- POGODA KONIEC --> <div id="content"> <?PHP include('news.php'); ?> <? if(0 == $page) { $page = 1; } $start = MAXPAGE * ($page - 1); $full = MAXPAGE; { //dany text } if($_GET[page] == '') { $strona = '1'; } else { $strona = $_GET[page]; } $poprzedniastrona = $_GET[page] - 1; if($_GET[page] == '') { $nastepnastrona = '2'; } else { $nastepnastrona = $_GET[page] + 1; } if($total == '0') { } else { echo'<table align="center"> <tr> <td>'; if(($_GET[page] == '1') || ($_GET[page] == '')) { } else { echo'<a href="index.php?event=users&page=1"><input type="submit" value="'.$lang[pierwszastronakatalog].'"></a><a href="index.php?event=users&page='.$poprzedniastrona.'"><input type="submit" value="'.$lang[poprzedniastronakatalog].'"></a>'; } if($strona == $total) { } else { echo'<a href="index.php?event=users&page='.$nastepnastrona.'"><input type="submit" value="'.$lang[nastepnastronakatalog].'"></a><a href="index.php?event=users&page='.$total.'"><input type="submit" value="'.$lang[ostatniastronakatalog].'"></a>'; } echo'</td> </tr> </table>'; } ?> </div> <div id="sidebar2" class="sidebar"> <ul> <li> <form id="searchform" method="get" action="#"> <div> <!-- MENU PRAWE START --> <?PHP include('include/menuprawe.txt'); ?> <!-- MENU PRAWE KONIEC --> </ul> </div> <div style="clear: both;"> </div> </div> </div> </div> </div> <!-- STOPKA START --> <div id="footer"> <?PHP include('include/stopka.txt'); ?> <!-- STOPKA KONIEC --> </div> </body> </html>
{ //dany text }
<? #Informacje o bazie danych includowane z pliku news_cfg.php include("news_cfg.php"); #łączenie się z bazą danych. Wymagane do odczytania Newsów z bazy $connect = mysql_connect($host, $user, $haslo) or die('<h2>Błąd podczasz łączenia się z bazą danych'); $wybieranie = mysql_select_db($base, $connect) or die("<h2>Błąd Wybierania bazy danych, Prawdopodobnie taka Baza nie istnieje"); `id` int(11) NOT NULL AUTO_INCREMENT, `tytul` text NOT NULL, `opis` text NOT NULL, `autor` text NOT NULL, `data` text NOT NULL, `tresc` text NOT NULL, PRIMARY KEY (id) ) #Pobieranie Newsów z bazy danych #pętla { include("wyglad.php"); } ?>
<? #Dane # {$news['autor']} = Autor Newsa # {$news['data']} = Data Dodania Newsa # {$news['opis']} = Opis Newsa # {$news['tytul']} = tytul newsa # {$news['tresc']} = Tresc Newsa # {$news['id']} = ID newsa #Koniec danych #w znacznikach echo <<< wyglad umieszczacie czysty KOD HTML, z użyciem {$news['cos']} gdzie cos to AUTOR/DATA/OPIS/TYTUL/TRESC/ID echo <<< wyglad <div class="flower"></div> <div class="post"><div align="center"> <h1 class="title">{$news['tytul']}</a></h1> <div class="entry"> <p> {$news['tresc']} </p> <p> <strong><div align="right"><font size="1">dodano : {$news['data']} <br /> autor : {$news['autor']} </strong></font></div><p> <p class="links"><a href="#" class="more"></a></p></div> </div> </div> wyglad; ?>