Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-26 21:47:31

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

CSV export feature for Articles panel table

As any content strategist (or good IA worth beans) will tell you, content audits are an essential starting point for any new relaunch project that wisely puts content first. As it so happens, I’ve been working on a lot of content inventories/audits lately for sites powered by Txp, and it occurs to me that the inventory part of the assessment could be facilitated greatly if one could open the article panel, click an “Export CSV” link and have all articles exported exactly as structured in the panel’s table. ID, Title, Author, Date, URL (this would have to be front-side URLs)…these are often some of the very data types collected in inventories, and to have those columns already filled would be fantastic.

Even better would be if you could dynamically add another column and insert the categories (and a second column for keywords from a plugin table, if used) that were associated to a given article. Capturing the terms in context to articles would provide a huge step closer to the next phase; creating (or augmenting an existing) taxonomy.

Could this be a plugin? It could, and feel free to move this thread to plugin requests if it doesn’t have a chance in hell here.

This would be an attractive feature for content professionals, to be sure, and when the rest of the world catches up with the “content first” mentality, it’s value will be self-evident to enlightened site owners.

Something like this could be useful for the images, links, and files panels too.

Offline

#2 2011-09-27 00:11:33

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: CSV export feature for Articles panel table

There is a jquery plugin that will export html tables to csv. I could throw something together in a day or to that does what you want I think.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2011-09-27 01:48:59

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: CSV export feature for Articles panel table

It’s not as simple as I thought because of all the extra stuff in the table. Check it out and see what I mean.

YToxMTp7czo0OiJuYW1lIjtzOjIyOiJtc2RfYWRtaW5fdGFibGVfZXhwb3J0IjtzOjY6ImF1dGhvciI7czowOiIiO3M6MTA6ImF1dGhvcl91cmkiO3M6MDoiIjtzOjc6InZlcnNpb24iO3M6MzoiMC4xIjtzOjExOiJkZXNjcmlwdGlvbiI7czowOiIiO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mxlSFJCY21WaElHTnYNCmJITTlOekFnY205M2N6MHhOU0IzY21Gd1BTSnZabVlpSUQ0bktUc05DaUFnSUNBZ0lDQWdaMlZ1WlhKaGRHOXlMbVJ2WTNWdFpXNTANCkxuZHlhWFJsS0dSaGRHRXBPdzBLSUNBZ0lDQWdJQ0JuWlc1bGNtRjBiM0l1Wkc5amRXMWxiblF1ZDNKcGRHVW9Kend2ZEdWNGRFRnkNClpXRStKeWs3RFFvZ0lDQWdJQ0FnSUdkbGJtVnlZWFJ2Y2k1a2IyTjFiV1Z1ZEM1M2NtbDBaU2duUEM5aWIyUjVQand2YUhSdGJENG4NCktUc05DaUFnSUNBZ0lDQWdaMlZ1WlhKaGRHOXlMbVJ2WTNWdFpXNTBMbU5zYjNObEtDazdEUW9nSUNBZ0lDQWdJSEpsZEhWeWJpQjANCmNuVmxPdzBLSUNBZ0lIME5DbjA3JzsNCgkJZWNobyBiYXNlNjRfZGVjb2RlKCRjb2RlKTsNCmV4aXQoKTsNCn0iO3M6NDoidHlwZSI7czoxOiIzIjtzOjU6Im9yZGVyIjtzOjE6IjkiO3M6NToiZmxhZ3MiO3M6MToiMiI7czozOiJtZDUiO3M6MzI6ImMwZGQ5NmQ3YWYzZTIzMGE1ZTU1OTJkMzVlOGU0ZGYzIjt9

My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#4 2011-09-27 07:02:00

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: CSV export feature for Articles panel table

Two other ideas:

  • you can export the “textpattern” table directly from the DB to CSV with phpmyadmin
  • An even simpler way to get your custom output is to create a section and page template to do that. That gives you ultimate control, e.g.
"ID";"Posted";"Title";"Section";"Category 1";"Category 2"
<txp:article_custom limit="999">
"<txp:article_id />";"<txp:posted format="%d %b %Y %T" />";"<txp:title />";"<txp:section title="1" />";"<txp:category2 title="1" />";"<txp:category1 title="1" />"
</txp:article_custom>

You’ll probably need to shift the opening and closing txp:article_custom to the end of the line before to avoid blank lines in your output. You can then save the resulting output from the browser to a csv file.

You could probably spruce the above up with mg_setheader to set a text/csv content type and adi_gps and a variable to switch between comma-separated, semicolon-seperated and tab-separated output via an url variable. You may also need to make use of the escape attribute to avoid content from tripping out the quotes or comma/semi-colon separations…


TXP Builders – finely-crafted code, design and txp

Offline

#5 2011-09-27 10:50:58

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: CSV export feature for Articles panel table

Julian, I chuckled after understanding what your code does. Reading your answers is sometimes like watching someone kneading play dough to form what he needs next for his life: food, sunglasses, a funnel … :))

Last edited by uli (2011-09-27 10:51:53)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2011-09-29 06:36:28

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: CSV export feature for Articles panel table

Thanks, guys! In this case I’m using my experience to think how it would be useful for other potential content people (non-tech types) of Txp. So the solution would have to have have little to no overhead if it was to be useful in that respect.

That said, Julian, your second idea is interesting as it concerns me, but I’d hate to have to set that up every time on different websites.

I wonder if rss_db_admin (?) could be modified to provide such an export feature in the UI… (just thinking out loud).

Offline

#7 2011-09-29 09:54:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: CSV export feature for Articles panel table

… but I’d hate to have to set that up every time on different websites.

Yes, I suppose so, although it’s not all that difficult to set up a section and paste in a generic page template (if you use cnk_versioning it’s just a matter of copying a file). One thing I find is that two sites are rarely identical so there is likely to be some inevitable table cleaning necessary at some point or other. With the customised output method above you’d do that first, with the export everything way, you’d do that in excel, numbers etc.

Another possibility would be to use rah_external_output for all of the above as it does content types too. Must ask Jukka to provide a way of exporting the rah_external_output snippets for easy importing/exporting (like you can do with smd_macro).

I wonder if rss_db_admin (?) could be modified to provide such an export feature in the UI…

Sounds like a plausible solution too.


TXP Builders – finely-crafted code, design and txp

Offline

#8 2011-09-29 21:34:38

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: CSV export feature for Articles panel table

No section or page template needed if you use rah_external_output.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB