Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thank you. It’s nice to know own code being used by others.

    It’s difficult to say something with that little information.

    Something you can try right away is to import some of the small examples distributed with the importer. They should not take long. If they do I would suspect a problem with the hosting. If they are fast but your csv files are not it would be interesting to see an example of your files to see if either them or the importer could be improved.

    For illustration, here is the header I used (shortened to a maximum of three comments, but you get the idea…):

    [Large code excerpt removed by moderator. Per forum rules, please use the pastebin for all large code excerpts. It works better anyway.]

    I have sent you the patch. It is not that big actually, but I am also not 100% happy with it. However, it worked for me, so I don’t have a direct reason to improve upon it anymore.

    The reason why I am not really happy has to do with the way comments have to be specified – but that is inherent to the problem: Comments belong to Posts. The only easy way to connect a comment to a post in _one_ csv file I could find is to write the comment data on the same line as the post data. Now this has some problems:

    • Data for one comment consists of multiple fields, but multiple comments are possible as well. This means that there has to be some comment id in the headers. This id doesn’t go into wordpress. It is only there to have the connection information in the csv file.
    • The number of comments per post can be quite different from post to post. However, there has to be one header for each possible comment. This means you have to know (or guess) a number equal or greater than the maximum number of comments for any given post, and generate all of those headers. This was not a big problem for me, as I did do that import once and that number was ‘only’ 17.
    • Even when a post doesn’t have that maximum number of comments, or not even a single comment, the post line has to contain a lot of empty fields, otherwise the whole post doesn’t import. That seems to be a limitation of the csv-reader. However, that’s also not a big issue because it is easy to add a lot of commas to the end of each line in the csv file. There seems to be no problem adding more of them than needed.

    I just extended the exporter to handle comments as well, to some extend. If there is interest I would be happy to share this, in the hope it will be part of a future release of cvs_importer.

Viewing 5 replies - 1 through 5 (of 5 total)