[support] display/hide a cck text field based on the input cck date field

crazy guru crazyguru85 at gmail.com
Thu May 21 01:17:15 UTC 2009


Hi Francesco,

Thanks for your time and the reply. As far as i know, i can refer to a cck
field ( in computed field) as $node->field_data[0]['value']; but i am also
wondering how to refer a cck field in node body with php input. according to
the suggestion given by "Marcus" (http://drupal.org/node/466694), i am
trying to use some php code to hide and display a cck field in node body.

Beside this, here is the code i have used for computed field to display and
hide a cck field.

$content1 = $node->field_data1[0]['value'];
$content2 = $node->field_data2[0]['value'];
$t=getdate();
$today=date('D, m/d/Y - H:s',$t[0]);
$due_date = $node->field_whatisdate[0]['value'];
if ($due_date >= $today){
  $node_field[0]['value'] = $content1;
}else{
  $node_field[0]['value'] =  $content2;
}

*Display:*
$display = $node_field_item['value'];

This is how i tried but no luck. i still have issues. please check with
this. Thanks in advance.

With regards
Mohan


On Wed, May 20, 2009 at 4:37 PM, Francesco <entuland at gmail.com> wrote:

> Hi Mohan,
> I've read your lines:
>
> > I'm trying to display/hide a cck field based on the input given in
> another
> > field. My situation is i need to show a cck text field based on the
> server
> > time...if it doesn't matches, I need to display another cck text field.
>
> and the thread you mentioned on Dupal.org:
>
> > You can see my details in forum post here http://drupal.org/node/466694.
>
> So far, I wasn't able to understand if the logic should be applied at
> input time or at render time.
>
> > I guess i can do this using "Computed fields". I read and got some clue
> from
> > this post (http://drupal.org/node/182473 ) but yet i couldnt get this
> done .
>
> Maybe computed fields could make it for input time, but in any case it
> could be useful if you explain in deeper detail the steps you've
> already done and report the PHP you're using, so that others can
> reproduce it and check out what's not working.
>
> If you have to apply the logic only at render time you can achieve it
> with Contemplates quite easily.
>
> Hope this helps,
> regards,
> Francesco
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090521/3610bcb7/attachment-0001.htm>


More information about the support mailing list