[wp-hackers] Storing Tabular Content in the Database

scribu scribu at gmail.com
Tue Feb 17 18:54:20 GMT 2009


You could create a table that stores each file in a single row, with a
column for a name and a column for the data, defined as BLOB (this would
work for reasonably sized files).

As for the HTML rendering, I don't know if you should store the CVS in raw
form, or already rendered.

On Tue, Feb 17, 2009 at 8:02 PM, Mohammed K. al-Safi <msafi at msafi.com>wrote:

> My question is about allowing WordPress users to easily display tabular
> content on their blog; providing them with tools to easily do so.
>
> I'm creating a plugin that will ask the user to select a CSV file from
> their
> HDD and then store the content of this CSV file, *some how*, and display it
> as HTML on a page or a post. I know, there already is a plugin by Alex Rabe
> called wp-Table. However, I believe there is plenty of room in this area
> for
> another plugin.
>
> At any rate, I need your help on how I should store the tabular content
> that
> the user uploads via this plugin.
>
> My first thought was to take a CSV file and create a new MySQL table that
> mirrors the CSV file. So, for every CSV file the user wants to display on
> the blog, I'd end up with a corresponding MySQL table in WP's database. I
> would also create a table to keep track of these CSV tables.
>
> I explained the aforementioned implementation to some people on irc://
> irc.freenode.net/mysql and they said that this is definitely not the way
> to
> do it. They were talking about database schemas, data normalization and
> some
> stuff that, honestly, I don't think is practicable or applicable for this
> plugin. But the people in the IRC channel didn't really understand the
> situation as well as you would, so I want your opinion and help.
>
> As an alternative solution, I thought that maybe I will generate the HTML
> for the table, and just store that. Kind of like how WordPress would store
> a
> post or something...
>
> Which implementation should I follow?
>
> Thanks,
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
http://scribu.net


More information about the wp-hackers mailing list