1

I have a content type with the following fields: Name, Language, Date, Photo, Text associated with the following names for internal use: title, language, field_date, field_photo, body

I created instances. One of these is called "Mondovi." I would like to see only the fields field_data and body of this instance. I want to use php to put them within the content or within a block. What to do?

4
  • This doesn't really make a lot of sense. You could probably re-write it to prevent it being closed.
    – Chapabu
    Oct 11, 2012 at 13:59
  • know how to do? If you do not understand what I do, what is not clear?
    – Antilope
    Oct 11, 2012 at 14:07
  • The language and structure of the question makes it far too ambiguous.
    – Chapabu
    Oct 11, 2012 at 14:11
  • @Chapabu I tried
    – Antilope
    Oct 11, 2012 at 14:29

1 Answer 1

2

Let assume that you are using Drupal 7

You need to know nid of node "Mondovi".

Then you can use following code:

$node = node_view(node_load(NID_OF_NODE));

// print value of body field without field label
print render($node['body'][0]); 

// or print body value with field label and all div wrappers
print render($node['body']); 

// print value of field_data without field label
// if field can have multiple values - use cycle to dipslay all of them
print render($node['field_data'][0]);
2
  • Hello, Can I enter these commands php in a template where I can also make html / css? in this case, which would be more suitable for the file do it, and how to proceed right? If I put these commands into blocks, then I need a way to group them ...
    – Antilope
    Oct 15, 2012 at 9:57
  • The best way is to create MODULE which provide custom block - read here how to do this drupal.stackexchange.com/a/5587/7313 Oct 15, 2012 at 13:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.