fork download
  1. <?php
  2. function paginator($data)
  3. {
  4. require_once(__DIR__ . './../files/request_url.php');
  5. $page = isset($_GET['page']) ? intval( $_GET['page'] ) : 1 ;
  6. $currentUrl = request_url();
  7. $nextPage = $page + 1;
  8. $previousPage = $page - 1;
  9. $firstPage = 1;
  10. $countPerPage = 3;
  11. $countStudents = count($data);
  12. $pageCount = ceil( $countStudents / $countPerPage);
  13. $noteNumber = $page * $countPerPage;?>
  14. <div class="panel panel-default">
  15. <!-- Default panel contents -->
  16. <div class="panel-heading">Список уже зарегистрированных абитуриентов</div>
  17. <div class="panel-body">
  18. </div>
  19. <table class="table">
  20.  
  21. <tr><td>Имя</td><td>Фамилия</td><td>Пол</td><td>Группа</td>
  22. <td>Email</td><td>Средний Бал</td><td>Местный/Приезжий</td><td>Год Рождения</td>
  23. </tr>
  24.  
  25. <?php for ($k = $noteNumber - $countPerPage; $k < $noteNumber; $k++): ?>
  26. <tr><td> <?=$data[$k]['Name'] ?></td>
  27. <td><?= $data[$k]['Surname'] ?></td>
  28. <td><?=$data[$k]['Sex'] ?></td>
  29. <td><?=$data[$k]['GroupNumber'] ?></td>
  30. <td><?=$data[$k]['Email'] ?></td>
  31. <td><?=$data[$k]['Mark'] ?></td>
  32. <td><?=$data[$k]['Local'] ?></td>
  33. <td><?=$data[$k]['BirthDate'] ?></td></tr>
  34. <? endfor ?>
  35. </table>
  36. </div>
  37. <nav>
  38. <ul class="pagination">
  39. <li>
  40. <a href="http://localhost/php/register/index.php?page=<?=$firstPage?>" aria-label="Previous">
  41. <span aria-hidden="true">&laquo;</span>
  42. </a>
  43. </li>
  44. <?php if($previousPage >= $firstPage):?>
  45. <li><a href="http://localhost/php/register/index.php?page=<?=$previousPage?>"><?=$previousPage?></a></li>
  46. <?php endif ?>
  47. <li><a href="http://localhost/php/register/index.php?page=<?=$page?>"><?=$page?></a></li>
  48. <?php $page++;
  49. if ($nextPage <= $pageCount):?>
  50. <li><a href="http://localhost/php/register/index.php?page=<?=$nextPage?>"><?=$nextPage?></a></li>
  51. <?php endif ?>
  52. <li><a href="http://localhost/php/register/index.php?page=<?=$pageCount?>" aria-label="Next">
  53. <span aria-hidden="true">&raquo;</span>
  54. </a>
  55. </li>
  56. </ul>
  57. </nav>
  58. <?php
  59. }
  60.  
Runtime error #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '}' in /home/z2x3gy/prog.php on line 59