[FREE] How to export every single topic content as a separate file?

Started by Keyword, March 31, 2014, 08:04:10 PM

Previous topic - Next topic

Keyword

There is a specific task where I have to have every single topic content be exported to a separate Word document (or rtf, or txt file) in each board of a particular forum.

It may need a couple lines of coding (in any language, be it PHP, some Script or even VBA) while exporting the forum database, as the output will have to be in the following structure:

- each topic with all posts (or at least of the 1st page) in it to a separate file, named after the topic title (only posts' content needed, without post author's name, time-stamp and etc, but preserving the post order like a dialogue);

- each board to a separate folder named after the respective board name.

I know that the exporting the forum content in this way may sound weird, but as I mentioned the task itself is specific and the result needs to look like in that way, which is a challenge for me.

Any help will be greatly appreciated.

Thank you.

Irisado

From the look of this, you're asking someone to explain to you how to do it, so that you can do it yourself.  If that is so, this is the wrong board for this.  You'd only be asking here if you want someone else to have access to your forum to do this for you.

Please could you clarify which it is you want.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

Keyword

Irisado, thank you. Actually, it is kind of intersection of both, but mainly I'm asking someone to help, as I'm not that familiar with coding and databases. I thought if someone could offer a solution based on sample SMF 1.1.19 and then I'd implement it to the forum by myself.

But now, reading the quote in your signature, I'm afraid that even if the versions of SMF are the same, but different settings, customization and different mods installed can make it almost impossible to test in one and implement in another  :)  Nevertheless, still have a hope.

Irisado

If you're trying to do this for 1.1.19, then it may be better off if I move this to SMF 1.1.x Support for now, because it seems to me that what you're asking is more support oriented.  Just to confirm before I do, is this the current version of your forum?
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

Keyword

OK, you know better. And yes, the current version of the forum is 1.1.19.

Irisado

Note to other team members.  I've moved this here from Help Wanted for the time being, because it seems to be more of a support issue.  Feel free to move again if it reverts to a help wanted request as per that board's sticky.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

margarett

Depending on the number of topics/ posts, this can be more or less straightforward, just with some workload. And the problem that you're on 1.1 and I'm pretty rusty on that :P

Basically you need to get an array with all your board ids and names. Then perform a foreach and, inside:
- create a folder with the name
- fetch all topic ids and names (needs a join to messages table) from such board, again run a foreach. Inside:
  - create a file with the name of the topic
  - fetch all messages related to that topic, ordered by id. Again, run a foreach. Inside:
     - for each message/post, parse BBC and write the parsed content to the file
     - write a separator to the file
  - close the file

Not that hard, hey? :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Keyword

Quote from: margarett on April 01, 2014, 07:40:45 PM
Depending on the number of topics/ posts, this can be more or less straightforward, just with some workload. And the problem that you're on 1.1 and I'm pretty rusty on that :P

Basically you need to get an array with all your board ids and names. Then perform a foreach and, inside:
- create a folder with the name
- fetch all topic ids and names (needs a join to messages table) from such board, again run a foreach. Inside:
  - create a file with the name of the topic
  - fetch all messages related to that topic, ordered by id. Again, run a foreach. Inside:
     - for each message/post, parse BBC and write the parsed content to the file
     - write a separator to the file
  - close the file

Not that hard, hey? :P

Thank you for your attention. That forum has 20.000+ topics with total 42.000+ posts. From only a general idea that I've about coding and databases, I could also guess that this needed a couple lines of code, however I have no any practical programming skills as such. Seeing your pseudo-code I believe that you got the main idea, but unfortunately all that I can comprehend is that it's written in English.  :) Bad for me...  :(

margarett

Actually it's not "a couple" and file handling is really not my thing...

I can try to make something happen, but I can't promise...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


Advertisement: