In the following book page i will theme a CCK Contenttyp in 3 different ways. First I post the Contenttyp:
This should be a bill which could the sent to an client, therefore I have the following fields
title
field_client // A node reference to a contenttyp called client to get the adress data etc.
field_seller // A user reference to a roll called seller, so that you can have a analyze of your workers
field_bill_text // A text to the client which is added to the bill
field_pay_date // A Date on which the client has to pay, this could be f.e. used for views
field_a_nr // A node reference to a contenttyp called article to get the description, the price per article
field_a_count // How many articles, on aboves type was salled; perhaps you could add a functionality whether there are some articles, which are availible
field_bill_me // ME = Mailing exchanges, how many should be added to the price
This fields are supplemented with a lot of computed fields , f.e. one for getting the price per article
field_a_nr); $i ++)
{
$article = node_load($node->field_a_nr[$i]['nid']);
$node_field[$i]['value'] = $article->field_price[0]['value'];
}
?>
or for summand all articles to an end price
field_r_articleprice); $i ++)
{
if (is_numeric($node->field_r_articleprice[$i-1]['value']))
{
if (is_numeric($node->field_a_count[$i-1]['value']))
{
$node_field[$i-1]['value'] = $node->field_r_articleprice[$i-1]['value']*$node->field_a_count[$i-1]['value'];
}
}
}
?>
So the user doesn't have to calculate any more.
Steps:
1. Creation of Themes
The first theme was a basic try to use theming form, f.e. how can fields be displayed in a table
bill-edit.php
The second theme displays the form as Tabs with JSTabs in JSTools
2.bill-edit.tpl.php
The third theme displays the form like the standard way but with a css class .item. This class is used by jquery to hide, first each element, and than show the next form by clicking the next link or the key [page down]
First you have nothing
Than after 3 [Page downs]
3.bill-edit.tpl.php
3bill.js
2.problems
For submitting the form I had to have: