Location: PHPKode > projects > WH Community > wh_community/blog.php
<?php require('layout/header.php'); ?>

<div id="content_wrapper">
    <div class="content">

		<span class="blog_left"><a href="blog_search.php"><?php echo $lang['blog_search']; ?></a> &#8226; <a href="blog_rss.php" target="_blank">Blog Feeds</a></span>
		<span class="blog_right"><?php
		
		$articles = mysql_query("SELECT blog_id FROM blog") OR die(mysql_error());
		$total = mysql_num_rows($articles);
		
        echo '' . (int)$total . ' ' . $lang['articles'] . ' &#8226; ';
		
		$comments = mysql_query("SELECT blog_id FROM comments") OR die(mysql_error());
		$total2 = mysql_num_rows($comments);
		
        echo '' . (int)$total2 . ' ' . $lang['comments'] . '';
		
        ?></span><br>
    
    	<?php
    
    	$pfad = $_SERVER["PHP_SELF"];
    	$query = mysql_query("SELECT blog_id FROM blog") OR die(mysql_error());
    	$total = intval(mysql_num_rows($query));
    	$seiten = ceil($total / $datensaetze_pro_blog);
    
    	if(empty($_GET['page'])) {
    			$page = 1;
    		
    		}elseif($_GET['page'] <= 0 || $_GET['page'] > $seiten) {
    			$page = 1;
    		
    			}else{
    			
    			$page = mysql_real_escape_string($_GET['page']);
    			}
    		
    		$links = array();
    		
    		if(($page - $p) < 1){ $davor = $page - 1;  }else { $davor = $p; }            
    		if(($page + $p) > $seiten){ $danach = $seiten - $page; }else{ $danach = $p; }    
    			$off = ($page - $davor);
    		
    		if($page- $davor > 1) {
    			$first = 1;
    			$links[] = '<a href="' . $pfad . '?page=' . $first . '" title="' . $lang['goto_first_page'] . '" class="topicby">&laquo; ' . $lang['first'] . ' ...</a>';      
    			}
    		
    		if($page != 1) {
    			$prev = $page-1;
    			$links[] = '<a href="' . $pfad . '?page=' . $prev . '" title="' . $lang['page_back'] . '" class="topicby"> &laquo;</a>';     
    			}
    		
    		for($i = $off; $i <= ($page + $danach); $i++) {
    		if($i != $page) {
    			$links[] = '<a href="' . $pfad . '?page=' . $i . '" class="topicby">' . $i . '</a>';
    		
    		}elseif($i == $seiten) {
    			$links[] = '<span class="current_main">' . $i . '</span>';  
    		
    		}elseif($i == $page) {
    			$links[] = '<span class="current_main">' . $i . '</span>';
    			}
    		}                
    		
    		if($page != $seiten) {
    			$next = $page+1;
    			$links[] = '<a href="' . $pfad . '?page=' . $next . '" title="' . $lang['next_page'] . '" class="topicby"> &raquo;</a>';
    			}
    		
    		if($seiten - $page - $p > 0 ) {
    			$last = $seiten; 
    			$links[] = '<a href="' . $pfad . '?page=' . $last . '" title="' . $lang['last_page'] . '" class="topicby">... ' . $lang['last'] . ' &raquo;</a>';
    			}
    		
    		$start = ($page-1) * $datensaetze_pro_blog;
    		$link_string = implode(" ", $links);
    	
    	$query = "SELECT * FROM blog ORDER BY blog_id DESC LIMIT $start,$datensaetze_pro_blog";
    	$result = mysql_query($query) OR die(mysql_error());
    	
    	if(!$result) {
    	
    	echo '<br><p><h1>' . $lang['no_articles'] . '</h1></p><br><br>';
    	
    		}else{
    	
    		if(intval(mysql_num_rows($result)) == 0) {
    		
    		echo '<br><p><h1>' . $lang['no_articles'] . '</h1></p><br><br>';
    	
    	}else{
    			
    	while($row = mysql_fetch_assoc($result)) {
    	
    		$idc = (int)$row['blog_id'];
    		$allcomms = mysql_query("SELECT blog_id FROM comments WHERE blog_id2 = '" . $idc . "'") OR die(mysql_error());
    		$speech = mysql_num_rows($allcomms); 
        	
        	include_once('functions/bbcode.php');
        	
        	echo '<table width="100%" class="blogtable">
        	      <tr><td width="50" align="center" valign="top"><div class="spch-bub-outside">
            	  <span class="point"></span>
            	  <span class="bubble">' . (int)$speech . '</span>
        		  </div></td>
        		  <td valign="top"><div class="whole"><p><span class="disc_tags">' . htmlentities($row['title'], ENT_QUOTES) . '</span></p></div>
        		  <span class="leftside"><img src="images/user.png" alt="User"> <a href="mailto:' . $webmaster . '" class="topicby">' . htmlentities($row['author'], ENT_QUOTES) . '</a></span>
        		  <span class="rightside">';
                  
                  if($language == "de") {
                      echo date('d.m.Y - H:i', strtotime($row['date']));
                  
                  }elseif($language == "en") {
                      echo date('Y-m-d - H:i', strtotime($row['date'])); }
                  
            echo ' ' . $lang['o_clock'] . '</span>
                  <div id="head_line">&nbsp;</div>
                  <div class="whole"><p>' . parseBBCode2HTML(nl2br(stripslashes($row['post']))) . '</p></div>
                  <span class="leftside"><img src="images/latest.png" alt="Comments">&nbsp;&nbsp;<a href="blog_comments.php?id=' . $row['blog_id'] . '">' . $lang['read_comments'] . '</a> | 
                  <a href="blog_comments.php?id=' . $row['blog_id'] . '#comment">' . $lang['write_comment'] . '</a></span>
                  <span class="rightside"><a href="blog.php#top"><img src="images/icons/top_small.png" alt="Top" hspace="5" border="0"></a> 
                  <a href="blog_rss.php" target="_blank"><img src="images/icons/rss_small.png" alt="Blog Feeds" border="0"></a></span></td></tr>
                  </table>';
                  }
    	
    	echo '<div id="blog_line">&nbsp;</div><br><span class="pages_main">' . $lang['page'] . ' <u>' . $page . '</u> ' . $lang['by'] . ' ' . $seiten . '</span>';
    	echo $link_string;
    	
        }}
        
        echo '<div class="spacer_div">&nbsp;</div>';

    	?>
	</div>
</div>

<div id="infobox_wrapper">
    <div class="infobox">
        <?php include('layout/infobox.php'); ?>
    </div>
</div>

<?php require('layout/footer.php'); ?>
Return current item: WH Community