Hi
This is reference to http://drupal.org/node/17565
I am using a new template file for a new content type I made using CCK. How can I access the individual fields that I created, in the template file ?
I tried this :- <?php print serialize($node->field_idnumber)?> (field_idnumber was the field that I added)
and the output I got looked something like :- a:1:{i:0;a:2:{s:5:"value";s:6:"123123";s:4:"view";s:6:"123123";}}
Now how can extract the data i.e 123123 from this ?
The article mentioned above, says that probably a php code is needed for this ? Can't it be accessed in way similar to title i.e $node->title
PS : I did tried this :- $node->field_idnumber->value but this doesn't seem to work
Thanks and Regards Abhinav Jain
Here's a good place to start looking for CCK formatting information:
From the output you are showing, $node->field_idnumber is an array, so to print out the "value" cell, try this:
<?php print $node->field_idnumber[0]['value']; ?>
Marc
Abhinav Jain wrote:
Hi
This is reference to http://drupal.org/node/17565
I am using a new template file for a new content type I made using CCK. How can I access the individual fields that I created, in the template file ?
I tried this :-
<?php print serialize($node->field_idnumber)?>
(field_idnumber was the field that I added)
and the output I got looked something like :- a:1:{i:0;a:2:{s:5:"value";s:6:"123123";s:4:"view";s:6:"123123";}}
Now how can extract the data i.e 123123 from this ?
The article mentioned above, says that probably a php code is needed for this ? Can't it be accessed in way similar to title i.e $node->title
PS : I did tried this :- $node->field_idnumber->value but this doesn't seem to work
Thanks and Regards Abhinav Jain