Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
if (!$_GET["page"]) $_GET["page"] = 1;
$dir = "posts/"; //задаваме папката
$show = 1; //колко резултата на страница
$thedir = opendir($dir);
while (false !== ($file = readdir($thedir))){
if (in_array($file, array(".", ".."))) continue;
$files[] = $file;
}
$total = ceil(count($files)/$show);
foreach ($files as $file){
$nr++;
if ($nr >= $_GET["page"] && $nr < $_GET["page"]+$show){
include "$dir$file";
}
}
$next = $_GET['page'] + $show;
$prev = $_GET['page'] - $show;
for($i=1 ; $i<=$total ; $i++)
{
if(($page)==$i)
{
echo "[".$i."] ";
}
else
{
echo "<a href=\"?page=".$i."\">".$i."</a> ";
}
}
?>