Advertisement
Nicba1010

Evo kak to radim!

Jan 18th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.01 KB | None | 0 0
  1. <?php
  2.    
  3.     $id=$_GET['id'];
  4.     if (!isset($id)){
  5.         $id=0;
  6.     };
  7.     $page=$_GET['page'];
  8.     if (!isset($page)){
  9.         $page=0;
  10.     };
  11.  
  12. ?>
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  17.         <meta name="viewport" content="width=device-width, initial-scale=1" />
  18.         <meta name="apple-mobile-web-app-capable" content="yes" />
  19.         <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  20.         <title>
  21.         </title>
  22.         <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
  23.         <link rel="stylesheet" href="my.css" />
  24.         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
  25.         </script>
  26.         <script src="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.js">
  27.         </script>
  28.         <script src="my.js">
  29.         </script>
  30.     </head>
  31.     <body>
  32.         <!-- Home -->
  33.         <div data-role="page" id="page1">
  34.             <div data-theme="a" data-role="header">
  35.                 <h3 id="name">
  36.                     Novine(t)
  37.                 </h3>
  38.                 <div data-role="collapsible-set">
  39.                     <div data-role="collapsible" data-collapsed="true">
  40.                         <h3>
  41.                             <center>Kategorije</center>
  42.                         </h3>
  43.                         <div>
  44.                             <a href="index.php?id=0" data-transition="fade">
  45.                                 Naslovnica
  46.                             </a>
  47.                         </div>
  48.                         <div>
  49.                             <a href="index.php?id=1" data-transition="fade">
  50.                                 Vijesti
  51.                             </a>
  52.                         </div>
  53.                         <div>
  54.                             <a href="index.php?id=2" data-transition="fade">
  55.                                 Internet
  56.                             </a>
  57.                         </div>
  58.                         <div>
  59.                             <a href="index.php?id=3" data-transition="fade">
  60.                                 Lifestyle
  61.                             </a>
  62.                         </div>
  63.                         <div>
  64.                             <a href="index.php?id=4" data-transition="fade">
  65.                                 Recenzije
  66.                             </a>
  67.                         </div>
  68.                     </div>
  69.                 </div>
  70.             </div>
  71.             <div data-role="content">
  72.             <?php
  73.                     $con = mysql_connect("**************","*********","************");
  74.                     if (!$con)
  75.                      {
  76.                      die('Could not connect: ' . mysql_error());
  77.                      }
  78.  
  79.                     mysql_select_db("novineti_wordpress", $con) or die('Invalid query: ' . mysql_error());
  80.                     mysql_query("SET NAMES 'utf8'");
  81.                     mysql_query("SET CHARACTER_SET 'utf8'");
  82.                     $limit1= $page * 10;
  83.                     $result = mysql_query("SELECT * FROM wp_posts WHERE post_status='publish' ORDER BY  `wp_posts`.`post_date` DESC LIMIT ".$limit1.",10") or die('Invalid query: ' . mysql_error());
  84.  
  85.                     while($row = mysql_fetch_array($result))
  86.                      {
  87.                      $string=$row['post_content'];
  88.                      preg_match('<img[a-zA-Z0-9_\^\$\.\|\{\[\}\]\(\)\*\+\?\\~`!@#%&-=;:",/\n\s]*/>', $string, $link);
  89.                         if (empty($link[0])) {
  90.                            
  91.                         } else {
  92.                           $link5 = explode('src="', $link[0]);
  93.                           $link6 = explode('" ', $link5[1]);
  94.                           echo '<div class="ui-grid-a">
  95.                             <div class="ui-block-a">
  96.                              <div style="width: 90%; height: 100%; position: relative; background-color: #fbfbfb; border: 1px solid #b8b8b8;">
  97.                                  <img src="'.$link6[0].'" alt="image" width="100%"/>
  98.                              </div>
  99.                           </div>
  100.                           <div class="ui-block-b">
  101.                             '.$row['post_title'].'
  102.                           </div>
  103.                         </div>';
  104.                      echo "<br />";
  105.                         }
  106.                      
  107.                      }
  108.  
  109.                     mysql_close($con);
  110.             ?>
  111.             <?php echo $_GET['page'] ?>
  112.            
  113.             </div>
  114.             <center>
  115.             <a href="index.php?id=
  116.             <?php
  117.            
  118.                 echo $id;
  119.            
  120.             ?>
  121.            
  122.             &page=
  123.            
  124.             <?php
  125.            
  126.                 if( $page==0) {
  127.                     echo $page;
  128.                     $pageminus=$page;
  129.                 }else{
  130.                     $pageminus=$page-1;
  131.                     echo $pageminus;
  132.                 } ?>
  133.             ">
  134.             <?php echo $pageminus+1; ?>&lt; </a><?php echo $page+1; ?>
  135.             <a href="index.php?id=<?php echo $id ?>&page=<?php $pageplus=$page+1; echo $pageplus; ?>">&gt;<?php echo $pageplus+1; ?></a></center>
  136.             <div data-theme="a" data-role="footer">
  137.                 <h3 id="copyright">
  138.                     &copy; Novine(t) | 2012-2013<br />
  139.                 </h3>
  140.             </div>
  141.         </div>
  142.     </body>
  143. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement