Drupal theming…


Drupal theming plays a more important role in the customization of the site,
But lots of people are struggling with theming cck fields.

Here are some of the way to theme fields in node template files

THEMING NODE REFERENCE FIELD

<?php $nid=field_node_ref[0][‘nid’];
$refnode = node_load($nid); // $nid contains the node id of the referenced node
?>
$refnode contains the full node

To get particular cck fields from the reference node is by using the following code

<?php $refnode->field_name[0][‘view’] ?>

THEMING CONTENT PROFILE FIELD

Here i assume that you know about the configuration option for the content profile module, so i will proceed with theming those content type fields in node.tpl

<?php $uid=field_key_speakers[0][‘uid’]; ?> //user id of user reference field

<?php $speaker=content_profile_load(‘profile’, $uid); ?>

where ‘profile’ is the content profile content type

so it loads all the profile cck fields in the var $speaker.
Now select the particular fields using

<?php $speaker->field_name[0][‘view’]; ?>

That can help some one!!

Advertisements
About

Working For Cause Not For Applause

Tagged with: , , , ,
Posted in Drupal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: