Pagination without MySQL

2 replies
Hello everyone! I'm wondering if it's possible to make PHP pagination without using MySQL? I've read a lot of tutorials, but they give a PHP file with a MySQL script and I've no idea what to do with the file. Someone said I'll need to upload the images (I want to paginate) to a MySQL database, but the problem is - I don't know how to do that.

So, is there a way to paginate my pages without MySQL? Like in CuteNews? CuteNews don't require MySQL and they are paginated.

Thanks!
#mysql #pagination
  • Profile picture of the author ramsarvan
    Hi,

    It is really difficult and more over I don't know that,

    But you can try this ,

    1.Divide the images into even numbers ie, (if you have 30 images, place it in six div's each containing 5 images).

    2. Give the id value of each div from one to six(by words) respectively.

    3.Now, hide all five div's except first div by using it "style='display:none;'". After that

    4.At the end open a div and and place the numbers 1 | 2 | 3| 4 | 5 |6

    5. Anchor these numbers to a javascript function like this
    <a href="javascript:show('one');">1</a>

    similarly to all numbers,

    6. Finally, define the show(a) and in it
    function show(a) {
    document.getElementById('one').style.display = "none";
    document.getElementById('two').style.display = "none";
    document.getElementById('three').style.display = "none";
    document.getElementById('four').style.display = "none";
    document.getElementById('five').style.display = "none";
    document.getElementById('six').style.display = "none";

    document.getElementById(a).style.display = "block";
    }

    It will do..
    {{ DiscussionBoard.errors[4573042].message }}
  • Profile picture of the author Tashi Mortier
    Originally Posted by regarsfo View Post

    So, is there a way to paginate my pages without MySQL? Like in CuteNews? CuteNews don't require MySQL and they are paginated.

    Yes, they don't need MySQL, but I guess their solution is even more complicated - basically you have to come up with your own file structure to replicate a database then.


    You can always work with a simple text file and read it line by line with a function like file(), then you can use count() to determine how many lines there are. Final step is then to display the images for the current page and show links to the other pages.

    A line in this txt file could look like this

    appletree.gif|An apple tree|appletree.html

    With explode(), you can then easily split the information contained in such a line.

    You can then just use an offset and start showing images beginning with the x-th element of the array.

    Did that help? What is it exactly that you want to achieve?
    Signature

    Want to read my personal blog? Tashi Mortier

    {{ DiscussionBoard.errors[4577337].message }}

Trending Topics