我有一个非常复杂的脚本,它不能完全与MySQL一起工作,但它的确有部分功能。让我试着解释...我的情况分页?
我的网页的结果纯粹是从一个特定的文件夹图像名称,意味着我用这个函数来得到我的结果:
function get_all_images($dir)
{
$dir = opendir($dir);
$dirArray = array();
while($entryName = readdir($dir))
{
if(($entryName != ".") && ($entryName != "..") && ($entryName != ".svn") && ($entryName != ".htaccess"))
{
$dirArray[] = $entryName;
}
}
closedir($dir);
(sizeof($dirArray)) ? arsort($dirArray) : '';
return (is_array($dirArray)) ? $dirArray : '';
}
这是怎么了我基本上得到的结果在我的网页:
<?php
include('includes/header.php');
$images = get_all_images('i');
$url = str_replace('www.', '', generate_site_url());
$flag = false;
$count = 0;
if (empty($images))
{
echo '<h2>There are no uploaded images</h2><br>';
}
foreach ($images as $image)
{
$filename = $image_name = $image;
$image_link = $url . IMAGES_PATH . $filename;
$user_id = fetch_user_id($image_link);
$delete_link = (isset($_POST['delete_link'])) ? $_POST['delete_link'] : '';
$delete_image = (isset($_POST['delete_image'])) ? $_POST['delete_image'] : '';
if ($delete_admin_submit)
{
unlink('./t/' . $delete_image);
unlink('./t/big' . $delete_image);
adminDelete('./i/' . $delete_image, $delete_link);
header('Location: ' . $imgit_action);
exit();
}
echo '<div class="' . ($count++ % 2 ? "odd-color" : "even-color") . '">';
echo '<table>';
echo '<tr><td class="fullwidth"><a class="preview_img" href="' . $image_link . '"><img src="' . $image_link . '" title="Click to enlarge" width="300" class="thumb" /></a></td></tr>';
echo '<tr><td><span class="default">Direct link:</span> ';
echo '<input type="text" readonly="readonly" class="link-area" onmouseover="this.select();" value="' . $image_link . '" />';
echo '<form method="post" action="" onsubmit="return confirmSingleDeletion();" style="display: inline;"> ';
echo '<input type="submit" class="icon_delete" name="delete_link" value="' . $image_link . '" title="Delete this image" />';
echo '<input type="hidden" name="delete_image" value="' . $image_name . '" />';
echo '</form>';
echo '</td></tr>';
echo ($flag) ? '<hr /><br>' : '';
echo '</table>';
if (!empty($user_id))
{
echo '<br><strong class="normal">Uploader ID:</strong> ';
echo '<em class="normal">' . $user_id . '</em><br>';
}
echo '<br>';
$flag = true;
}
?>
<a href="<?php echo $home_action; ?>"><span class="button-sub">« Back to Index</span></a>
<?php echo '</div>'; ?>
<?php include('includes/footer_alt.php'); ?>
现在我没有任何简单的线索如何开始打破我的成果转化为网页。我在这里工作的结果超过12000个,页面加载需要很多,我需要帮助将这个大的结果分解成页面。
任何人都愿意帮助我吗?至少给我一个线索如何开始?我会很感激。
非常感谢您的阅读。
这会是任何使用你的? http://stackoverflow.com/questions/5105810/view-files-in-directory-with-pagination-php – 2012-08-11 14:30:32
我会尝试从中得到一些东西。将回报。谢谢。 – Aborted 2012-08-11 14:46:13
似乎无法使您的链接得到这个东西。 :\ – Aborted 2012-08-11 15:15:10