Is it possible to theme individual tables independently? I just found this module because I have that exact client requirement, and was checking out the html output, but it doesn't seem as if the tables are getting the tablemanager unique num/name as an id (turning on tablemanager.css seems to only add "class=tablemanager")-- am i missing something stupid simple or is this the way it works?
If this is the way it works, I would think in order to add that functionality I would have to add a line after the "$attrib['class'] = 'tablemanager';" (line#1045) similar to "$attrib['id'] = ". $something.";" but I'm not sure what the variable is where the tablemanager id# and/or name is stored. Am I on the right track? thanks.....
Comments
Comment #1
pobster commentedHeh, it just takes a little imagination ;o)
Yes, turn on the css. This allows the module to import the css from this file; tablemanager/misc/tablemanager1.css
Where you're displaying the tables (and I'm assuming you're using a filter?) set a unique class in the attributes.
Now... This will 'fool' tablemanager into applying its own tablemanager1.css file (as it does this first) but then you're overriding it setting its own class and so you can then add the unique table css to that file.
Simple really... Unless I've perhaps misunderstood something?
Pobster
Comment #2
pobster commentedIncidentally, just to let you know about the forthcoming release (TM2!) This has a more comprehensive css selectbox giving you a range of styles which you can now apply per table. I'm also toying with the idea of integrating the colour picker module (like in the Garland theme), but I've discovered I'm really no good at javascript, so that may have to wait for a while...
Erm... Probably should point out at this point though that TableManager v2 is still a way off from a dev release. I keep chopping and changing stuff at the moment (well, not right at the moment, I haven't touched it for a fortnight and I'm moving house in 10 days so it'll be shelved for a while then too) - rest assured though, that it now at least looks quite professional and I'm really rather proud of it! :o)
Pobster
Comment #3
WorldFallz commentedThanks for the QUICK reply! I knew I had to be missing something stupid simple. You understood my question perfectly-- so, to individually style a specific instance of a table I can do this:
[tablemanager:1, NULL, FALSE, NULL, title = My Table | class = "myclass"]
or this
[tablemanager:1, NULL, FALSE, NULL, title = My Table | id="myid"]
do i need the quotes? (it seems not from your example on the project page).
Now for the jackpot question-- is there any way I can force the tables displayed via the /tablemanager page(which currently get their style from the default theme css i think)to use these?
Let me explain my use case-- I'm envisioning a page of tables at /tablemanager that I create with titles like "Black on White w Red Borders" or "White on Black wo Borders" etc. Basically a standard defined list of maybe 12 or so different styled tables. It would be nice if when they clicked on the link in the list, the table would open up with the approriate style-- which it won't if I don't specify the class/id until it's created with the filter.
The best I can figure, and I'm by no means a developer, is I need those "sample" tables at /tablemanager originally created with class=tablemanager and id=1 (or any variation like class=tablemanager1 or id= tablemanager1) so then i can style them by id in the one tablemanager.css file (mine is not tablemanager1.ss for some reason, but tablemanager0.css-- does that make a difference?). When i examined the output with firebug the sample tables at /tablemanager had the same "class=tablemanager" tag.
I'm trying to really dumb this down for my users who just don't know css. If I can figure out a way to do it this way, then they don't ever need to worry about CSS at all--- not even to pass as parameters they just do
[tablemanager:1, NULL, FALSE, NULL, title = My Table] for each table and they don't have to know any css.
does that make any sense at all? or am i making it more unclear, LOL?
And I'm looking very forward to v2-- you have no idea how much grief this little baby is going to save me. Trying to explain how to create & style tables, even WITH tinymce, is a nightmare. I must have 60 modules on my site now--- but this is the one that put a real smile on my face... GREAT JOB!
Comment #4
pobster commentedAh yeah sorry my bad, the file is tablemanager0.css - originally I *borrowed* (*cough*) a load of css from the table module, as I didn't know any css at all so it was just easier that way. The files were 1, 2, 3, etc... And so when I wrote my own css I named it 0 to come before the rest. Not that you needed the history lesson I guess! ;o)
It's going to be a little trickier to alter the tablemanager list page to include the css but it's not impossible. I'm afraid I don't have a 'normal' Drupal 5.x install of tablemanager though so I'll have to take a look at it tomorrow (it's just after midnight here in the UK!)
I'll get right back to you...
Thanks,
Pobster
Comment #5
WorldFallz commenteda brit! us yanks just love the brits! LOL. I miss the UK... i haven't been in 2 years, and even then I didn't want to leave. I just wanted to call it quits and buy one of those lovely sheep farms in york. maybe one day...
No worries... this is definitely NOT something you should miss any sleep over. I know I'm close... i'm fairly certain the place to add the class is line 1045 (paragraph2 in my original post), I just couldnt find the variable that holds the table # (and would give it a unique id.
thanks again for looking into this.
Comment #6
pobster commentedMorning! Well morning for me anyway ;o)
Yes you were more than close, you can safely change that line 1045 to something like;
$attrib['class'] = 'tablemanager-table-'. $tid;Else if you'd prefer you can use $name rather than $tid, but then table names don't have to be unique so you'd perhaps run into problems there? If you'd rather have separate css files for each table id, you can safely alter these lines;
If the css file doesn't exist then it'll use the default 'tablemanager0.css' file instead (or you could just
return;and not import a css file). Hope this helps!Pobster
PS. York is beautiful, we went there last year - it was like stepping back in time!
Comment #7
mshaver commentedDo you know where in the table display I could also include class elements for the cells? Since the
Thanks for the great module.
Comment #8
pobster commentedUnfortunately Tablemanager doesn't 'produce' its own tables, it simple creates a Drupal compatible array which it passes to Drupals own table creating function. Whilst this is fairly limiting I've tried to provide as much functionality as I can by allowing class tags to be applied to cells individually when you're entering data, eg;
(enter this into a cell)
[bgcolor = red]Angry Cell!
[class = cupcake]I like cakes
etc...
I know it's not ideal, but it was never the aim of this module to provide complex tables - it was created just to simplify things for my Dad.
Pobster
Comment #9
mshaver commentedThanks, that works for me!
Comment #10
pobster commentedComment #11
WorldFallz commentedFor completeness, I should have posted back my solution which is working famously so far.
In tablemanger.module after line 1045 ($attrib['class'] = 'tablemanager';)
I added the following line:
$attrib['id'] = ' tablemanager-table-'. $tid;
This will add an id="tablemanager-table-x" attribute (where x is the table number) to the table tag for individually styling tablemanager tables.
Comment #12
pobster commentedI like that, I've added it to the 6.x-dev release.
Thanks :o)
Pobster
Comment #13
WorldFallz commentedExcellent! Glad I could contribute back... even just a little. 8-)