Support » Plugin: TablePress » HTML import is broken in latest version

  • Resolved VA_swimmer

    (@va_swimmer)


    I recently updated to the latest version of TablePress and now HTML import does not work for me. I usually create an HTML table from an Emacs org-mode table, and that has worked fine in the past. But now it does not, with TablePress version 1.8.1.

    I cleaned up the HTML code produced by org-mode export so that it was a bare table (no headers and such) but still no dice.

    Help would be appreciated! Thank you.

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Could you elaborate what exactly the error is? Does the table just come out differently? Or are you getting an error message?

    Could you maybe upload the HTML file somewhere or email it to me? And could you please post the “Debug Information” from the “About” screen of TablePress?

    Regards,
    Tobias

    Thread Starter VA_swimmer

    (@va_swimmer)

    Thank you for your quick response. There is no error message, just a blank screen and the file is not imported (i.e., the table doesn’t change).

    Here is a link to the table as produced by org-mode (which I never had trouble importing before):

    https://www.dropbox.com/s/zfd5akbikz9948z/UpcomingEvents.html?dl=0

    Here is a link to a stripped-down version of the table, which also did not work:

    https://www.dropbox.com/s/iz92ev3tobznxm0/UpcomingEvents2.html?dl=0

    Debug information is below.

    · Website: http://www.vaswim.org/wp
    · TablePress: 1.8.1
    · TablePress (DB): 35
    · TablePress table scheme: 3
    · Plugin installed: 2013/03/15 18:22:27
    · WordPress: 4.8.2
    · Multisite: no
    · PHP: 5.3.27
    · mysqli Extension: false
    · mySQL (Server): 5.5.54
    · mySQL (Client): 5.5.54
    · ZIP support: yes
    · UTF-8 conversion: yes
    · WP Memory Limit: 128M
    · Server Memory Limit: 128M
    · Magic Quotes: off
    · WP_DEBUG: false
    · WP_POST_REVISIONS: true

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for that! It seems that the issue from https://stackoverflow.com/questions/35845819/fatal-error-cannot-use-object-of-type-domnodelist-as-array could play a role here.

    Please try changing line 178 of the classes/class-import.php file from

    $table = simplexml_import_dom( $dom_tables[0] );
    

    to

    $table = simplexml_import_dom( $dom_tables->item( 0 ) );
    

    Thanks!
    Tobias

    Thread Starter VA_swimmer

    (@va_swimmer)

    Thanks, Tobias. When I examine that file, I find the line number is 180 (not 178) and that it currently reads

    $table_html = simplexml_import_dom( $dom );

    That is the only call of the simplexml_import_dom() function that I see in the file. I don’t know PHP (or maybe I wouldn’t be using WordPress), and I am loathe to change the line since it does not match what you have posted here and I don’t know exactly what the change will do.

    Thread Starter VA_swimmer

    (@va_swimmer)

    My apologies, my local folder had not synced with the remote. I’ll check on it and get back to you…

    Thread Starter VA_swimmer

    (@va_swimmer)

    Found the current version, made the change…but I don’t have permission to upload to the server. I’ll have to check with the sysadmin to do that.

    Thread Starter VA_swimmer

    (@va_swimmer)

    But — and sorry to flood you with questions — wouldn’t any such change get clobbered with the next TablePress update?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    this change relates to TablePress 1.8.1 which is why you saw that difference to your old local copy.

    And yes, in theory, this would be overwritten again after an update, but if this fix works for you, I will add it to future versions, permanently 🙂

    Regards,
    Tobias

    Hi Tobias!

    I had the same issue importing HTML files described by @va_swimmer.
    I have just made the fix you proposed and it worked.

    Please try changing line 178 of the classes/class-import.php file from

    $table = simplexml_import_dom( $dom_tables[0] );
    to

    $table = simplexml_import_dom( $dom_tables->item( 0 ) );

    Thanks for your help!
    Adrian.

    Thread Starter VA_swimmer

    (@va_swimmer)

    I finally got permission, but this edit did NOT work for me. Now when I click on the Import tab, I get a blank screen.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    oyscjpb: Great, thanks for the confirmation!

    va_swimmer: That sounds like some error happened when editing the file. Can you please set the WP_DEBUG constant to true in your site’s wp-config.php file, via the instructions from https://codex.wordpress.org/Editing_wp-config.php#Debug ? This should show us an error message.

    Regards,
    Tobias

    Thread Starter VA_swimmer

    (@va_swimmer)

    Yes it was an editing error. I copied and pasted the text from the email message, which rendered the “>” character as the HTML special character “>” (it looks the same here but different in my email message). When I went straight to the source on the forums I noticed the difference.

    Sorry for the trouble, and thanks for your attention to the matter. It seems to work now.

    • This reply was modified 3 years, 8 months ago by VA_swimmer.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, ok. That explains it. Good to hear that the patch is working for you as well!
    I’ll add this to the next release!

    Best wishes,
    Tobias

    I appear to be having the same issue since the last update. I’m importing a large table and I keep getting this error:

    Fatal error: Cannot use object of type DOMNodeList as array in /home/ultimate/public_html/wp-content/plugins/tablepress/classes/class-import.php on line 178

    Tobias,

    It sounds like this will be remedied with the next release? What is my best option for fixing this in the meantime?

    Thank you,
    Brian

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Brian,

    yes, this will be fixed in the next version.

    In the meantime, please apply the code fix that I suggested above.

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘HTML import is broken in latest version’ is closed to new replies.