Theming CCK Output...
nimzie - October 14, 2008 - 17:32
I'm trying to get the help fields to output in my HTML before the other fields in my CCK form. Basically, I'm using the help fields as questions and want these placed first - or at least under the title - not under the question or edit field itself.
How would I go about doing this? I've looked in to a few things in and around CCK output but it's all a bit of a mystery to me.
Cheers - and thanks for any help / pointers.
Adam

I'm not exactly sure what
I'm not exactly sure what you mean by help fields, but you can order cck fields on the "manage fields' tab of the content type edit form by assigning an appropriate weight (lower weighted items float to the top).
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Contemplate
There is a module called "contemplate" that allows you to theme the cck fields output.
- Alexei Rayu.
Drupal Related Services | SiteHound 2.3 (based on Drupal 6.5) - Drupal for Beginners! Please test and comment.
I am looking to customize
I am looking to customize how the input form for the CCK type looks.
When building the content type, you can specify a "help" field. When collecting the data in the node/add/whatever form, CCK places the contents of the 'help' field below the input field itself.
For this specific type (survey), I would like to show the contents of the help field above the input field.
I hope that helps. contemplate allows me to style the output - which I may have used for my terminology but I hope I have been more specific in this posting.
Cheers,
Adam
You need to theme the CCK
You need to theme the CCK form (not the output as the tread title suggests), search for it on d.o I know there are several guides for this. hook_form_alter is the all powerful way to modify the output of a form.
BTW, not really sure CCK is the best tool for a survey, I would be looking at the Webform module. Using the webform module would allow you to insert "html fields" above each input field with some help text in it. You can "weight" each field (set the order) so its very easy and fast to generate what you want. Webform submissions do not become nodes (the webform form is itself a node), but the results are stored in the database, emailed to you and can be downloaded in a CSV file.
Maybe even Survey Monkey would be better, a specialised tool for a specialised task.
I Will look in to the
I Will look in to the webform module - thanks.
Cheers,
Adam
http://www.harostreetmedia.co
http://www.harostreetmedia.com/content/drupal-how-theme-cck-input-forms
got me there. This and another couple of articles about this put together got me to the place I needed to be @. The key was the hook in the template.php file.
I had to make a slight alteration so that it only used the new editor on my own form:
if ((arg(0) == 'node') && (arg(2) == 'edit')){$node = node_load(array('nid' => arg(1)));
if ( $node->type == event_type ){
function phptemplate_node_form($form) {
return _phptemplate_callback('event_listing_edit', array('user' => $user, 'form' => $form));
}
}
else
return;
}