Dynamic Field is a CCK field that returns a textarea where you can enter custom PHP code. The code is computed real-time and lets you access Drupal objects like $node, $user...

Note:
This is not a duplicate of ComputedField! ComputedField computes and saves the value in the database when the node is created but Dynamic Field doesn't store the computed value...it computes the php whenever the node is rendered in the theme.

Usage:
All you need to do is place the PHP directly into the CCK field without the <? ?> tag.

Below is an example to return the Node ID:

        $nid = $node->nid;
        return $nid;

Another example to return the Content Type:

        $ntype = $node->type;
        return $ntype;

Sponsorship:

This project is sponsored by SourceN. We provide specialist consulting services in Enterprise Drupal, Views & Panels, Visit us at www.sourcen.com or Contact us.

Project Information

Downloads