Loading...
Logo
Processing Forum
Hello Everyone,
I am looking for advice for the relevant technologies / libraries necessary to drive certain aspects of a Processing Applet from a MySQL database generated from Wordpress CMS.  I essentially would like to use a good/decent/freely available CMS to generate different layout structures in a Processing Applet.  The idea is that the Processing Applet acts as a wordpress Theme, updating as new content is generated in the wordpress CMS.

I have played with the MySQL library, but it seems not such a good idea to store the db credentials in the processing sketch.  I am imagining some sort of bridge written in PHP that processing could have access to that would be able to query the MySQL database for certain aspects of the wordpress structure such as categories and posts.

Any thoughts, links, or examples that would allow a processing applet to connect securely to a MySQL database would be greatly appreciated. 

Replies(6)

Sounds like the easiest thing might be to use the WordPress API to grab the content directly from WordPress:


That way you can avoid having to connect directly to the database entirely.
Thanks Martin.
I looked at this yesterday following your reply and it does seem like a nice way to go about it.

One question though, if I only have the applet .jar file online, is that still a security issue?  Is the idea that someone could unwrap the classes stored within?  Is this really that easy?  Just wondering because I did get a proof of concept running and querying certain aspects of the wordpress mysql database on the server...

Hmm, interesting question. It's certainly possible to decompile .jar files to read the API credentials - but then again, if a user were sufficiently motivated to that, then they might find it easier to just read the credentials as they are sent over the wire. I'm not sure what the solution is here.

Another possible solution - can you get all the data you need for your applet from the WordPress RSS/atom feeds? If so then you could do away with authentication entirely, and just use the public-facing data.
Thanks for the reply.

What I am mostly interested in using the categories and their children to generate an arboreal navigation structure then each node would display some content of the posts pertaining to that category.

For example...
I have a parent category 'projects'
I have several child categories: 'commercial,' industrial,' 'residential'
I use the categories on the relevant posts for those projects...
At least this is what I have in mind.  Lets see how far I get! 

I fully agree that your suggestions of just querying rss or xml-rpc are probably the correct and sane ways to go about this.  I think with xml-rpc I can get all of the category topology and posts.  Lets see if I can't whip up a test today.  Again, thanks for your responses!


I'm sure you can get rss feeds for categories & children. If you can't get them out-of-the box, then you can probably modify your theme and drop in a wp_list_categories tag, then parse the output of that inside your applet. That would probably still be quicker than messing about with database authentication!

Be sure to post a link when your project is finished - it is cool to see two of my favourite pieces of software being used together.
Procesing + Wordpress
Hey martin, here is the prototype.  Front end has a node class which takes arguments from querying the wp_terms and wp_term_taxonomy tables from wordpress.
I use the following MySQL query to get the appropriate category information:
Copy code
  1. rs = db.query("SELECT wp_terms.term_id,wp_term_taxonomy.parent,wp_terms.name,wp_term_taxonomy.taxonomy, wp_term_taxonomy.term_id FROM wp_terms,wp_term_taxonomy WHERE wp_terms.term_id=wp_term_taxonomy.term_id");
The database example was built from Fry's Visualizing Data book p.288 - 293, though this also works fine with the MySQL library by Florian Jennet.

Front end was created by my partner and first worked on a directory structure, now works on wordpress categories.

Even after your good advice, somehow I was more attracted to the MySQL version because for today it seemed like the path of least resistance.  I promise to go down the other paths very soon.

This was tested on Windows Firefox, Internet Explorer, and Chrome.  I have been told it does not work on Mac browsers...will have to check on this later on...

Will report back on how it goes with the other methods.