How do I calculate and permanently store a field value with code I would like to know how I can manually insert some PHP code inside a CCK node.

What I have is the following code for Drupal 6: 

$output .= '&lt;br&gt;';
$mor = _pitch_detalle($cid, $previamente, $luego);
if (sizeof($mor) &gt; 0) {
  $output .= theme('pitch', $mor);
}
return $output;


This code shows some information that changes from day to day, and each time the users view the page, the information changes.
I want the user to see an unmodified version of that code, the same information that existed when the user created the page.

As the user cannot edit the page, I´m looking to insert a php snippet inside a CCK field that will remain unchanged. But that could lead to problems, so is there any way to do that in a safe way?
Or maybe to insert code inside the template in other way?
I haven't done this myself before, so I cannot give really detailed instructions. I think I would do something like this:


Create a CCK text field in the content type(s) of your choice
Create a custom module and implement hook_form_alter
In your form alter function:

Give your CCK text field a #disabled property and set it to true (this will grey out the field so it cannot be edited)
Check if the field is already populated; if not, set the #default_value to the return value of the code in your question



This means that when Drupal builds the form, your custom module will disable the CCK field and put your content in it if that has not been done before. Because we're just populating a form field, all Drupaly stuff like the 'Display Fields' page will keep working.

I hope that helps.