I'm attempting to theme a CCK text radios field differently than its default output. By default, the user chooses an option at node/nid/edit, and when viewing the node, only sees the field's label and the value selected.

What I'd like to do is theme the field so that instead of its surrounding divs, it is output as a table row, with its label as its first column, and all possible values actings as the others.

To illustrate, rather than output like this:

Is the laundry done?:
No

It is possible to theme the output like so with the actual HTML being similar to:

<table>
<tr>
<td></td><td>Yes</td><td>No</td>
</tr>
<tr>
<td>Is the laundry done?</td><td></td><td>X</td>
</tr>
</table>

Comments

gp.mazzola’s picture

I am still a newbie but I think I can answer this...
You can do it easily with another module called Content Template (Contemplate) that allow to create for your nodes custom templates. It adds a tab in the Content Types page.

Or otherwise you can do it creating a template for your node and calling it:

node-your_content_name.tpl.php

editing it and putting it in your theme directory. You can just make a copy of a node.tpl.php standard, rename it as above and then edit it.

Well if I told something not correct I hope somebody is going to correct it :)

Ciao,
GP

bsuttis’s picture

Thanks for the reply, but that's not what I'm looking for.

Content Template just allows me to move fields around and put wrapping divs around them to aid in design etc etc. I suppose it's possible to do with contemplate, but still very tedious. I'm looking for a better way to do it.

ray_223’s picture

Read cck/theme/README.txt in your CCK directory.
It has instructions on how to theme all or individual fields.

Ray Smith
http://RaymondSmith.com

Anonymous’s picture