Jump to content

Archived

This topic is now archived and is closed to further replies.

paulrus

Multiple pages in PHP (not really OSC related)

Recommended Posts

Hi guys,

 

I have added a VERY simple blog to our site and I made one mistake when I created it. I didn't create a way for it to have multiple pages - so now the blog has 30 entries and it's really really long. I'm still very much a newbie with PHP, so I'm hoping someone can point me to some help.

 

I tried adapting a tutorial I found that counts the number of rows, creates a limit to the number that will be displayed and then makes pages based on how many rows you have, but it had a major problem. It used $PHP_SELF to pass the page information but when I would test it the URL it created was /catalog/?query=&page=5&limit=5 which is obviously very wrong. Could this be because my actual blog display code is written entirely as a function that I call from the catalog?

 

Basically my blog.php is just a blank OSC page with this in it:

 

include ("blogcontent.php");

writecontent();

 

Don't ask me why I did it this way because I can't remember. Anyway, I can send my code to anyone who wants to look at it. I'd really like to just have a link that says: Page(s): 1, 2, 3, 4, 5, and so on... but so far I can't manage to figure it out

 

Paul

Share this post


Link to post
Share on other sites

You should have a look at the split_page_results class and how its used.

 

It will reformat your sql queries automatically.

 

The version on the Administration Tool provides a pull down menu of available pages. The catalog version displays links to click on.


:heart:, osCommerce

Share this post


Link to post
Share on other sites

Paul, which blogger are you using?

 

I used cafelog.com's as theirs also has archiving built into it.

 

and you can seperate the pages by calling the script where you want it to appear as you normally would, but after your chosen amount of blogs, say 5 for example, it then will archive the rest and place them in a seperate page.

 

i.e. I have the latest 5 on my default.php page, then all that are older the the 5 latest are moved to a news.php page which is dedicated to News only.

 

You have to play around a little to get it to work, but it is a great little program, and on GPL too. Sweeeeeet... :wink:

 

CC.

Share this post


Link to post
Share on other sites

×