Új hozzászólás Aktív témák

  • trisztan94

    őstag

    Ahoy elvtársak!

    Próbálgatok egy lapozót csinálni, képeknél is ugyanezt használtam, de valamiért történeteknél nem működik.

    Itt lenne az kód:

    <?php
    $dataArray = array();
    //Number of chars for the string
    $num = 500;
    $dir = '../php/biralas_tortenetek/';
    $willcount = readdir(opendir($dir));
    $i = -1;
    //Check if </div>DIR e</div>xists
    if ($handle = opendir($dir)) {
    //Loop over the directory
    while (false !== ($file = readdir($handle))) {
    //Strip out the . and .. files
    if ($file != "." && $entry != "..") {
    //Store file contents
    $filecontent = file_get_contents($dir . $file);
    //Split the content and store in array
    $length = strlen($filecontent);
    $dataArray[$i++] = array(substr($filecontent, 0, $num), substr($filecontent, $num, $length ));

    }
    }
    //close the dir
    closedir($handle);
    }
    $totfiles = $i;

    $page = isset($_GET['page']) ? $_GET['page']-1 : 0;
    echo "<br/>";

    for($x=$page*1; $x < $totfiles && $x < ($page+1)*1; $x++) {
    $data = $dataArray[$x];
    ?>
    <div class="visible">
    <?php echo $data[0] . $data[1]; ?>
    </div>
    <?php
    }

    for($page=1; ($page-1)*1 < $totfiles; $page++)
    {
    echo "<div class='lapozo'><a href='../html/blog.php#tortenetek?page='$page''>$page</a></div>";
    }
    ?>

    Igazából az alja az ami lényeges.

    Köszi szépen! :R

Új hozzászólás Aktív témák

Hirdetés