Community & Support

Putting Tables into the Body of Content (newbie)

Hey there,

I'm working on an information site where there will be a lot of information repeated throughout each piece of Content (as Stories in my example). I'm sure this is something simple but I still haven't grasped all of the lingo yet, making it rather difficult to pinpoint what I exactly need!

So essentially, in each Story, I'm going to have a small table of data that will be similar across the board. Sort of like an At-A-Glance of the content that follows. You can imagine it sort of like if I was creating profiles of businesses, I want each post to have the Name, Address, E-mail, Web Address, etc... at the top, followed by the rest of the post will be text, a description, and whatnot.

Is this some funky combination of CCK / Views or something or other? That stuff still stumps me!

Also, down the line, if I do get these tables up, is there a way I can then, later create a table where the contents of said table are sortable by columns? (Not directly related to the previous example).

Thanks again for any help pointing me in the right direction!

-gary

Comments

This is not newbie stuff IMO

Hi,

I admire your desire to do this, but this will require quite a lot of advanced theming from my experience.

My site does something similar what you're after:
List of healers & practitioners

Click on a healer of choice, and at the top there is a table showing, as you say telephone numbers & addresses etc.

To do this I used Flexinode (you should use cck, as you've indicated).

I don't use views. The page is a hand coded tpl.php file (in my case flexinode-1.tpl.php). I managed to get it to work with a lot of trial and error. I hope you're a php programmer (I'm not), or at least a programmer of some sort.

To learn more about custom theming, look in the hand book Theme Developer's Guide. How you theme cck nodes, I'm not sure.

There may be another, simpler way to do what you want (there usually is in Drupal), but I can't think of one.

Hope this helps.

Cheers,
--
tys

BLUE MOUNTAINS health & harmony
www.health-harmony.com.au

building an alternative health & spirituality community in the Blue Mountains

--
tys

BLUE MOUNTAINS health & harmony
www.health-harmony.com.au

building an alternative health & spirituality community in the Blue Mountains

Oy the problem with Drupal

And not to talk bad about it. I have a bit of a tech background, and have researched several different CMS's, including Joomla which turned out to be too bulky for my tastes. I loved Drupal's extremely active community, as well as it's "feel". However, it bugs me that seemingly simple things seem so utterly complicated at times.

But like I said, I have a bit of a tech background (doing light web design work, and am an amateur perl guy), and am OCD about Web Standards so I'm trying to look for a "nicer" way to do it. Trying to be less hacky, as it were.

Would you mind giving me some code as an example so I can know how to get started? What you have looks great, btw. But I do hope someone else chimes in with a more easier answer, as it seems like something that would be rather useful to have.

Thanks!

Panels module

Have you thought of trying this?

Panels Module That would give you an area at the top of the page which is distinct from the main body of the post.

You could then code a php area in the panel with tables & the like. You should have access to the current node data $node (or at least get it from the args() function).

I've never played with it, but had a look at the dashboard module almost a year ago. It wasn't what I needed, and being a programmer (of some description) I found that modifying the theme was the best way to get exactly what I wanted in a general sense (the table summary is actually a recent addition).

To be honest, I can't help you out with specific coding unless I find out about theming cck.

Try these:
CCK for Themers
Teaser and Body Templates for CCK
CCK Fields, Teasers, etc - my solution
Use CCK to make a unique front page
HOWTO: Theme a CCK input form

And if you're still looking for more, type "theming cck" into the search, and spend the next couple of days going through all the results...

I can assist you with specific requests (displaying images, creating links, etc), but someone that has done cck theming will be more help.

Hope that helps.
Cheers,

--
tys

BLUE MOUNTAINS health & harmony
www.health-harmony.com.au

building an alternative health & spirituality community in the Blue Mountains

--
tys

BLUE MOUNTAINS health & harmony
www.health-harmony.com.au

building an alternative health & spirituality community in the Blue Mountains

CCK + Contemplate?

Hey Tys,

Thanks again for offering to help. Am checking out your links and also found a great one: http://www.lullabot.com/articles/an_introduction_to_the_content_construc... . Still a bit lingo heavy. I might end up writing up my own!

However, things still seem more difficult than it "should" be. I've been messing around with the already pre-built capabilities of CCK to define new Content Types (in this case, each business' profiles) and creating the necessary Fields. I found the Matrix Fieldset (http://drupal.org/project/matrix) for CCK, but it seemed a bit overkill. (I'm creating essentially a two column table, where the left side is just the names of each row. This seems more suited for a comparison matrix (multiple columns, etc). But perhaps the answer is still in this.

For the time being, I'm going to specify simple TextField Sets for each bit of information, than use Contemplate to style it into a Table... I think. If anyone thinks I'm about to blow things up by accident, please let me know :).

-gary

How did you get on?

How did you get on with this? Discover any simple solutions you'd like to pass on?

I am trying to do a very similar thing now myself. In my content types I have one field set of statistical information that I would like displayed as a simple two-column table (title, data).

I've had a look at Contemplate but it seems that if I go down this route then I can't make use of all the 'Display fields' settings that do just what I want for the rest of the fields and groups that make up the content type.

What would be ideal is a little module that added another display type to groups of 'table' that would render all the contained fields into a table – rather like the CCK Fieldgroup Tabs module provides Javascript tabbed display.