JohnTendik / jtrt-tables

A Wordpress plugin to help users create responsive tables without having to read or write code.
GNU General Public License v2.0
22 stars 6 forks source link

Parse Error #4

Closed ManikInsomniak closed 8 years ago

ManikInsomniak commented 8 years ago

I installed your JTRT Table plugin version 2.0.4 on WP 4.4.1, and unfortunately it is not functioning for me. Can you please advise on the issues below and how I may resolve them?

CSV Files are unable to be added via URL or the uploader, the Generate and Upload File buttons do not seem to initiate anything.

I also get the following error in the Table Style Editor window. "Parse error: syntax error, unexpected '[' in / / / / / /wp-content/plugins/jtrt-responsive-tables/admin/partials/jtrt-responsive-tables-post-meta-3-display.php on line 41"

Thank you

JohnTendik commented 8 years ago

:o Hello ManikInsomniak,

Thanks for trying out my plugin.

As for you issue I'm sorry you've been having problems. That's very interesting, I'm not really sure why that may be happening. Can you send me a copy of your CSV file? I'll take a look at it. In the meantime I'm going to try to investigate the parse error you're receiving. edit the table style editor is still in development so thank you for bringing this up. I would recommend not using it, since its very basic and kind of buggy I suppose :/ it was supposed to be disabled but I forgot to do so before releasing the update.

Also, I know it may be obvious but is this a fresh install? If not, did you try a reinstall?

Thanks, John

ManikInsomniak commented 8 years ago

Hey John, thank you for the quick response! Here is a small test file I was using to try out the plugin. Yes this was a new install, I was not using a previous version of the plugin. I did try an uninstall/reinstall with the same results. Standings.csv.zip

Thanks

JohnTendik commented 8 years ago

No problem :)

I tried to use your CSV in wordpres 4.4.1 using my plugin version 2.0.4 and it seemed to work, barely. At first this is how it came up: pic1

I checked out your CSV using excel and other than missing characters, it looked fine. I saved it as a .csv file but this time without the Microsoft extension and it worked a little bit better: pic2

Unfortunately I do not own a mac, I cannot test on apple environments so these types of conversion issues is somewhat expected. A previous user mentioned saving the csv files as a microsoft csv worked for him, but you did do that and still had issues. Once I get a mac, I would be in a better position to be able to catch these types of errors but for now the best thing to do is to try a bunch of different csv formats to see which one works best, and if neither do ask me to convert it for you :D Standing2s.zip

But, As you can see it did work for me so I'm not really sure what to say. I also couldn't reproduce the parse error, if you look at the pictures they're working fine. I tried with debug mode true and false- no avail.

At this point the only thing I can do is to ask question to try and narrow the problem.

Are you getting any errors when you try to generate the table? Did you try checking the console if there were messages you might have missed that didn't show up on the website? Are you using any other plugins? If so, did you try disabling them to see if it fixed anything? Plugins seem to cause errors for each other often it seems, it would be worth it to make sure that's not the case.

Let me know if you have any useful information like error messaging from the console, in the meanwhile Im going to keep looking for why there might be a parse error for you, if files aren't being loaded in correctly it could be the cause of both your issues.

Thanks John

ManikInsomniak commented 8 years ago

I have tried disabling every other plugin running on the site with no change in behavior.

This is the other error generated when trying to save a new table as draft or publish the item (granted a CSV has not been imported yet) but I thought it might save anyway.

Warning: array_map() [function.array-map]: Argument #2 should be an array in / / /wp-content/plugins/jtrt-responsive-tables/admin/class-jtrt-responsive-tables-admin.php on line 238

Warning: Cannot modify header information - headers already sent by (output started at / / /wp-content/plugins/jtrt-responsive-tables/admin/class-jtrt-responsive-tables-admin.php:238) in /home/content/g/r/g/grgraphics/html/kb/wp-includes/pluggable.php on line 1228

I don't want to waste your time, I was hoping maybe it was something encountered before and there was a solution. I appreciate your support and responsiveness.

ManikInsomniak commented 8 years ago

A couple more things Table Column Editor header displays a warning. I don't know if it shows this by default on a new item or not.

"Oops, Looks like something went wrong, Unfortunately the table you were looking for has not been found on the server, Please double check that you have the correct table ID set for the short code."

When Revolution Slider is active it adds a Choose Slide Template options box to the page

screen shot 2016-01-25 at 1 59 40 pm

JohnTendik commented 8 years ago

Woahh this is crazy. Thank you for bringing this up, I hope many people haven't experienced this issue. Its funny especially because of the "revolution slider option" appearing on the add table page. Lol, this plugin has nothing to do with revolution slider so its very interesting. I'm looking at the code and errors generated, if I find a find/solution I will be sure to let you know. Thank you for the images and error messages, they should some info I can dig into.

Also, this message

""Oops, Looks like something went wrong, Unfortunately the table you were looking for has not been found on the server, Please double check that you have the correct table ID set for the short code.""

is supposed to appear because there aren't any tables to display, you first have to generate and publish the tables for that error to go away.

I'll let you know if I find a solution for your issue.

Thanks again for trying out my plugin and the feedback! John

JohnTendik commented 8 years ago

Hey ManikInsomniak,

I think I may have found a solution to your problem, or at least one part of it :D I think you may have more than this specific issue but solving this will give key information to work with.

So just before I begin, do you know what version of PHP your wordpress is running on? The reason you're getting the parse error on the table styler is because of this line

$jt_container_text_align = ["left","center","right"];

on line 41. Its a simple array variable but older version of PHP do not support this syntax, hence the parse error. Your simply solution to this would be to change the line 41 to this

$jt_container_text_align = array("left","center","right");

You may also need to change line line 64 which is this

$jt_container_text_align = ["solid","dashed","dotted"];

to this

$jt_container_text_align = array("solid","dashed","dotted");

Try this for now, I will include this as a fix for the upcoming update but for now if you can try this out and let me know what happens it would help me out a lot. This should also fix the array_map() warning/error you receive when trying to save/publish a table.

Thanks again for working with me/giving me feedback, it really helps me out as well as other users. John

JohnTendik commented 8 years ago

Also which plugin is adding the "revolution slide" section to the tables page? Is it This one? There's a lot of slider plugins in the wordpress plugin directory and I don't know exactly which one you're referring to. I'd like to take a look at the code/do some testing to see if I can reproduce the problem.

Thanks John

ManikInsomniak commented 8 years ago

Hey John Yes, ThemePunch Slider Revolution is the correct one, v5.1.6 is what is installed. I will give the other lines you sent a go later today and get back with you.

PHP Version is 5.3.24

Cheers

JohnTendik commented 8 years ago

Hey ManikInsomniak,

Sooooo I tried to reproduce the revolution slider metabox appearing on the page and yes, when both plugins are active, there is an extra metabox that seems to creep its way into my plugin page. I checked out the code and I'm confident its because of this:

private function addSliderMetaBox($postTypes = null){ //null = all, post = only posts
        try{
            self::addMetaBox("Revolution Slider Options",'',array("RevSliderAdmin","customPostFieldsOutput"),$postTypes);
        }catch(Exception $e){}
    }

They have this nifty little function that will add a metabox when its called, and it takes a parameter of post_type which is the pages/posts it will appear on. But they call this function by doing this:

$this->addSliderMetaBox();

So they leave out the parameter for post type which means this metabox will be added on all of the pages/posts. My plugin creates a custom post type for tables for easier managing which is why the slider revolution thinks it's metabox belongs there.

I will try to find a way to mitigate this from happening from my end, but for now you can either pass in a custom parameter yourself such as

// the metabox will only show on posts
$this->addSliderMetaBox("post");

Or you can ignore it because I don't think it will cause much harm. Like I said I'll try and find a way to mitigate this obviously because if more plugins do this, then it can definitely cause some confusion to the user. Thanks again for bringing this up, I really appreciate it!

As for the other stuff, I'm now more confident it will solve your issue because indeed PHP versions <5.4 do not support the "var = [];" syntax. Let me know how that goes and if any more issues arise.

Thanks John

ManikInsomniak commented 8 years ago

After editing line 41, the same thing popped up on line 64, then after changing that one, again on line 97.

Parse error: syntax error, unexpected '[' in /home/content/g/r/g/grgraphics/html/kb/wp-content/plugins/jtrt-responsive-tables/admin/partials/jtrt-responsive-tables-post-meta-3-display.php on line 64

Parse error: syntax error, unexpected '[' in /home/content/g/r/g/grgraphics/html/kb/wp-content/plugins/jtrt-responsive-tables/admin/partials/jtrt-responsive-tables-post-meta-3-display.php on line 97

Once all those had been changed in the same manner, the Table Style Editor/Container Settings now appear and the file uploader is functioning. I will be moving the build to an environment with a newer PHP version in the next couple days, which probably would have resolved the problem as you mentioned, but this seems to have worked for its current home.

Thanks again

JohnTendik commented 8 years ago

Awesome! Glad it works now. Thanks again for bringing this up, I will include the array issue fix in the next update for better compatibility. If you come across any other issues please feel free to contact me and I will do my best to help out.

Thanks, John

-PS- I'm going to mark this as closed for now, if you still experience issues after this please let me know :)

ManikInsomniak commented 8 years ago

Will do, thanks again. Look forward to the growth of your product!