Hi there
Nice looking module - keen to get involved with some tweaking but first some bugs. After creating the table I try to add some data and I get nothing (i.e. no rows showing in admin or the actual page). On looking at my error log I see:
array_push(): First argument should be an array in /home/willwade/public_html/modules/tablemanager.module on line 272
It would suggest that the sql query is failing - odd since a load of serialized data does exist quite as it should be in the database.. all very odd
w
Comments
Comment #1
willwade commentedOk - sorry for the fast posting without looking into it further - I think its to do with some of the stuff I have put into the table - Its either not liking urls or brackets in the content. Cant figure it out at the mo. Hmmm.. does it need some escaping do you think??
Comment #2
willwade commentedYep. adding a url absolutley kills tablemanager
e.g. http://www.something.ac.uk/Courses/DepartmentCourseDetail.htm?CourseCode...
heck knows why yet - still investigating
Comment #3
pobster commentedAre you using anything different to me? I'm using mysql, Drupal 4.6.3 and PHP4?
It's probably my fault I'm not a programmer and so I don't know the 'correct' way to do things. I probably haven't declared that the variable should be an array before I used 'array_push()' somewhere. problem is... I've made sooooo many releases of this module so far (the latest is 1.1.2.13 - get it from here: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/tablemanager/... ) that I can't be absolutely sure what 'array_push()' statement is at fault. Let me know that as well and I'll look into it.
Pobster
PS. I do have a final release looming, I just need to get some advice with the filtering/ validation.
Comment #4
pobster commentedOops - mysql 4.1.14 I mean.
I'm having a distinct gut feeling that you're using PHP5 and that it isn't compatible...?
Pobster
Comment #5
pobster commentedI can't do anything about this unless you give me more information? I can't reproduce it on my own system.
Pobster
Comment #6
willwade commentedsorry for delay.. MySQL 4.0.25
Its probably more to do with escaping the POSTing string - might need a quick going over of with addslashes() before submitting to the table - doesnt make any sesne to me though - Im sure drupal already does all that. It's either that or something going wrong with serialize()
Need a bit more time to look into it - if you can't figure it out from my vague writings do not fear - as soon as I have finished the rather large 10,000 word essay Im currently writing (will be done by monday) I intend on helping you out on tablemanager - I need some of extra functionality (like column sorting, key types (text, long-text, numeric, url, tick (checkbox), price, date, etc), tool tip support and the ability to have long text fields
cool - and don't worry about your code - it is a bit messy but all fairly sound good logic - I think good enough to start calling yourself a "programmer" now :) (put it like this - its better than a whole load of the c**p out there - oh and it works)
Comment #7
willwade commentedoh and its php 4.3.11 ( see here http://sourceymonkey.com/test.php)
Comment #8
pobster commentedBefore you try hacking into it, make sure you're using the latest version from CVS - currently 1.1.2.16:
http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/ta...
Note that's not a CVS version, it's branched DRUPAL-4-6 in case anyones reading this and getting confused :o)
Anyways, I *think* I know where your array_push() problems came from. I think it's a mix up I had with the variable_get statement and earlier versions got confused sometimes and displayed when you deleted a 'low id' table and then created a new one. Just stupid beginner mistakes with code - I perhaps should have gone about it another way, but having never read a book on php and only kind of learning it from browsing through the php snippets page and semi understanding other peoples modules - I didn't really know any coding 'tricks'! Anyways :o) I'm pretty sure the newest version fixed the issue you were having in the first place - so upgrade and let me know how it goes.
For reference my mistake was to assume to start the variable_get reference from '1' when no tables are present. But of course, with an auto incrementing id on mysql tables it just keeps on going!
Also, as you mention in your comment - column sorting *is* implemented in this newest version. It's by no means complete and if you do have time (and I've not fixed it beforehand) then the outstanding to-do list for it is this:
Right... The paging problem... Picture this: you have 35 entries in a table paginated to 25 results per page. The code so far will pop the first 25 results out of the database - sort them and display them regardless of the other 10 entries still in the database! When you click on the next page, it then performs the sort on those last 10 items!!! :o) Okay so it's easily fixed by loading the WHOLE table into the $rows array and then sorting the whole lot but on huge databases I'm concerned that this may lead to slow page loading times? Not sure what to do with that really. I think after this weekend I'll go with the easy fix just to get it working so I can work on implementing the checkboxes/ option thingy.
Sorry about the blabbering, very tired...
Pobster
PS. If you'd like the test out the sorting, then change your tablemanager/ heading database into 'text' (VARCHAR 255 just isn't long enough) then stick this serialized string into it:
a:5:{i:0;a:2:{s:4:"data";s:4:"Type";s:5:"field";s:1:"0";}i:1;a:3:{s:4:"data";s:11:"Description";s:5:"field";s:1:"1";s:4:"sort";s:3:"asc";}i:2;a:2:{s:4:"data";s:4:"Size";s:5:"field";s:1:"2";}i:3;a:2:{s:4:"data";s:3:"RRP";s:5:"field";s:1:"3";}i:4;a:2:{s:4:"data";s:10:"Sale Price";s:5:"field";s:1:"4";}}
Comment #9
pobster commentedIncidentally... To bodge fixing your version, manually set the variable to show your table:
variable_set('tablemanager_table', 3); // if your table is number 3!
The module follows quite a strict path with that variable and I was concerned with it 'losing its place' but I've tested it and tested it with the current releases and the whole thing seems to stand up quite well (hopefully!!!)
Pobster
Comment #10
willwade commentedyeah - ta for that - the current cvs version works much better - good one
is there anything your having trouble with on the code side of things? If I start tinkering with the module I might as well do something that you want first :) send us a mail : http://drupal.org/user/17290/contact
Comment #11
willwade commentedIm such a wally - I somehow missed the whole piece on paging/columns - I'll take a look next week
Comment #12
pobster commentedOops! :o) Just got back home! (Been away since yesterday afternoon) - any help with the code would be a major help! As I don't particularly know how to go about things the 'proper way' and most of the ways I've done things has been 'borrowed' from other modules in one way or another (the code is all mine! :o) I just mean the way things are done is borrowed - for instance, the serialization is borrowed from flexinode - tbh, I hadn't even heard of a serialize command before starting programming this module!)
There is one thing I just absolutely haven't a single clue how to do... And that's change the CSV import from a 'cut and paste' into a textbox into a form_file with all the opening of the file and closing it again. As long as the whole thing gets stored into the '$whole' variable the rest of the code will not need to be altered (it'll probably need trim() though). Although... I only found out by playing with it and excel that CSV doesn't necessarily mean just comma separated... If the item has a comma in it then the item gets surrounded by " " marks and my function doesn't allow for that... And I really haven't a clue of how to go abouts changing it to get it to do that either!!!! :o) Bah, maybe this programming lark isn't for me after all ;o) I just love Drupal and I use it for three of my sites and I really wanted to give something 'back' to the community.
Pobster
Comment #13
pobster commentedWell I *think* its fixed anyways :o) The new version doesn't get muddled any more does it? I'm thinking that I really should prevent it getting muddled anyways just by checking it at the start of the function... I'll do that...
Pobster
Comment #14
pobster commentedNew version now cannot be muddled at all as it checks for it.
Pobster