I'm making a gallery made of php files in a directory.
When the php files embeded, I found scrolling effect beside showing
files and it's not showed at all. Anyone know of some php script that can fix this?
When the php files embeded, I found scrolling effect beside showing
files and it's not showed at all. Anyone know of some php script that can fix this?
Code:
<?php echo "<ul"; $filearray = array(); if ($fil = opendir("php00/")) { while (($file = readdir($fil)) !== false) { if ($file != "." && $file != "..") { $filearray[] = $file; $page = empty($_GET['page']) ? 1 : $_GET['page']; $num_per_page = 3; $total_pages = ceil(count($filearray)/$num_per_page); } } for($i = ($page - 1) * $num_per_page; $i < $page * $num_per_page; $i++) {?> ><li><a href="img/<?php echo $filearray[$i]; ?>"> <embed src="php00/<?php echo $filearray[$i]; ?>" alt="<?php echo $filearray[$i]; ?>" /> </a></li <?php } closedir($fil); echo "></ul>"; $pages = array(); for($i = 1; $i <= $total_pages; $i++) { $pages[] = "<a href=\"".$_SERVER['PHP_SELF']."?page=".$i."\">".$i."</a>"; } echo "Page: ".implode(" ", $pages); } ?>
Comment