Reply to comment

How to load only the content fields of a node to avoid a full node load?

Sometimes in scripts you need information stored in cck fields but you dont want to do full node loads neither do you want to query the table directly because setting a field from single to multiple value would make the table location of that field change.
For example a field in the content_type_team named field_team_name_value its table would change to content_field_team_name

<?php
//So this is wrong
$content db_fecth_object(db_query("SELECT * FROM content_type_team" WHERE nid = %d1));
$team_name $content->field_team_name;
//wont output nothing when field was set to multiple
?>

The content (ckk) api has a function to get all fields in just one call: content_storage($op, $node)

<?php
//This is correct
$node stdClass();
$node->nid 1;
$node->vid db_result(db_query("SELECT vid FROM {node} WHERE nid = %d",1));    
$node->type 'team';    
$content content_storage('load'$node);
$team_name $content['field_team_name'][0]['value'];
?>

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><p><b><i><table><th><tr><td><blockquote><br /><img /><tbody><span><strike>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <codes>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.