Jump to content

AJAX: Posts Per Month blog box


JustinM01

Recommended Posts

OK, I'm trying to make own homebrew blog. I have exactly one day of experience with AJAX, that day being yesterday. Anyways, I was able to get a simple AJAX commenting system going, but I have a problem with another portion of my site.

 

Basically, I'm trying to make a content box that lists each month there were posts for a particular year. Like this:

 

------------------------

| Post by Month for 2007 |

| <<<                    >>> |

------------------------

| January (1)                |

| February (2)                |

| April (4)                      |

-------------------------

 

I started by making a calendar class in PHP. It initializes to the current date and outputs the months with posts for the current year, 2007. Those arrows near the top of the box are supposed to decrease and increase the year, respectively. The problem is, my AJAX script routes to a PHP script sending a variable containing the requested year change, but when I initiate a new object from the calendar object and send the data back, it doesn't work. Now, this is because the objects in each page are different, so what happens is you can go to 2006 and 2008, but no farther than that. It also doesn't let you go back to 2007.

 

I thought about serializing the class and sending it through AJAX to my php script handler, but either you can't do it that way, or I can't figure out how to get it work. I thought about have a very simple MySQL table to store the variable, but that doesn't work, obviously, because every user on the site would be modifying the same variable.

 

Is there some other way to do this that I haven't thought of? I'm not looking for code so much as I'm looking for an explanation of how to do it, I should be able to figure out the code on my own.

 

Thanks for your time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.