View file news/coment.php

File size: 1.41Kb
<?php
if (@filesize($cms.'news/coment/'.trim($fn[3]).'.txt') == 0 || !is_file($cms.'news/coment/'.trim($fn[3]).'.txt')) echo 'Комментариев нет';
else
	 {
			    $st_r = 10;
			    // столько выводим

        	if (is_file($cms.'news/coment/'.trim($fn[3]).'.txt')) $post = @file($cms.'news/coment/'.trim($fn[3]).'.txt'); else echo 'Ошибка';

			$count_post = count($post);

			if (empty($_POST['fapages'])) {
			    $pages = 1;
			} else {
			    $pages = (int) $_POST['fapages'];
			}

			$j = ($count_post-1)-(($pages-1)*$st_r);
			$i = $j-$st_r;
			for(; $i<$j && $j>=0; $j--)
			{
			$fn = explode("|",$post[$j]);

			echo '
            <div class="mess1">
             <div align="left">'.$fn[0].' - '.$fn[1].'</div>
            </div>
            <div class="mess2">'.$fn[2].'</div>
			      <br>
			     ';
			}

			$all = ceil($count_post/$st_r);
			 echo '<table><tr>';
			 for ($i=1;$i<=$all;$i++)
			 {
			     if ($pages==$i) {
			        echo '<td><b class="knopka">'.$i.'</b></td>';
			     }
			     else
			     {
			        echo '<td>
			        <form name="" action="" method="post">
                    <input type="submit" class="knopka" value="'.$i.'">
                    <input name="fapages" type="hidden" value="'.$i.'">
                    </form>
			        </td>';
			     }
             }
             echo '</tr></table>';
	}
?>