<?php
$dir='../post';
$files1=scandir($dir);
$count=count($files1);
for($i=2;$i<$count;$i++){

$showface=str_replace("_"," ",$files1[$i]);
$reformat=strlen($showface);
if($reformat>45){
echo substr($showface,0,45).'...'.substr($showface,-6);
}
else
{
echo $showface;
}

//below this line,i want to paginate the listed directory
//but don't know.pls help!

}
?>