Randomize Content in a Very Specific Way

Hello,

I need a bit of help here. I am looking to pull content – at random – in a very specific way, and wondering if there is a CMS or plugin for CMS that would fit what I need.

Essentially, what I need to do is the following:

  1. Content #1 ~ #10 in Categories #1 ~ #10 – that is, I have 10 individual pieces of content (say, reviews) in 10 individual categories (say, movies, television, anime, etc.)
  2. On page load, pulls (at random) 1 piece of content from each of the categories, and displays them - that is, on page load, I want to randomly pull from content #1 through #10 of categories #1 through #10. Each category has only 1 piece of content pulled. They are displayed in order (content from category #1, followed by content from category #2, etc.)

Does anybody know how I can realistically achieve this with minimal work and effort?

I appreciate any help you can give me. Thank you very much.

I would create 10 arrays with the content for each category

I would then have 10 pieces of code that picked a random item from each array.

To make things a bit easier I would have either 10 folder containing each category’s articles and you can then use glob() to populate the array. Or prefix each article with something like mo_ for movies tv_ for television and again use glob() to populate the arrays.

You could probably automate the displaying of the articles as well but I do not know how you are laying them out on the page.

This could also be built into a simple function and just call the function where you want the results displayed.

Thanks for your reply, by the way.

Sorry, I should have prefaced by saying I’ve minimal PHP programming knowledge, so I’m not actually sure what the glob() function is.

As for displaying the content, each actual piece of content will be a single line (for example, 1 sentence reviews) and I will call upward of 150 lines at a time (edit: i typoed 1500, meant 150), separating each with a single BR tag. I would definitely like to automate the displaying of articles.

I was rather hoping I could make this work using something simple like Wordpress. Am I shooting for something quite ambitious here? I don’t think that I am – it seems fairly simple, but I’m unaware of any CMS that has similar functionality built into it.

Otherwise, could this be done with RSS feeds and forum software (categories become forums, content becomes posts, RSS feeds randomly pulls 1 post from each of the forums, which can then be automatically posted onto a blog article / CMS article)?

I would have thought there would be a plugin for something like that but the problem comes knowing what keywords you need to use to find it!
That is the problems with CMS - you can only use what somebody else has written and hope they keep their code up to date when the CMS is updated.

I hope you find what you want.

I understand your point. Thanks for taking the time to reply. I’ve been searching for WP plugins, but for the most part, they are quite limited (only displaying 1 post from 1 category on a page (as opposed to 1 post from 300 categories on a page), etc. and other similar limitations).

It looks like there are a couple of ways you can add php to a page:
1/ Create a custom template probably from an existing page
2/ Use the Wordpress php plugin

If you decide to go this way the php code should be quite straight forward.

Thanks for these two resources. I’ll also be looking at random post plugins in the hope of strong arming them into doing what I want. I’ll also be checking out your two options. Thanks again for taking the time.