Skip to main content
improved formatting
Source Link
arpitr
  • 7.9k
  • 2
  • 23
  • 48

I'm attempting to build custom template for specific content type. So, I created node--my-content-type.tpl.phpnode--my-content-type.tpl.php and tried to write some text: it works! Ok, now I want to render my fields. I have $content['field_title']$content['field_title'], field_authorfield_author, field_castfield_cast (is a field collection) etc. I

I need values of these fields, so I tried to assign some variables: $title = $content['field_title']['value']$title = $content['field_title']['value'] etc, but it doesn't seem to work. I can only call render function to render these fields, but I want to formtformat page in custom mode. How

How can I get field info in order to use correct values? Thanks!

I'm attempting to build custom template for specific content type. So, I created node--my-content-type.tpl.php and tried to write some text: it works! Ok, now I want to render my fields. I have $content['field_title'], field_author, field_cast (is a field collection) etc. I need values of these fields, so I tried to assign some variables: $title = $content['field_title']['value'] etc, but it doesn't seem to work. I can only call render function to render these fields, but I want to formt page in custom mode. How can I get field info in order to use correct values? Thanks!

I'm attempting to build custom template for specific content type. So, I created node--my-content-type.tpl.php and tried to write some text: it works! Ok, now I want to render my fields. I have $content['field_title'], field_author, field_cast (is a field collection) etc.

I need values of these fields, so I tried to assign some variables: $title = $content['field_title']['value'] etc, but it doesn't seem to work. I can only call render function to render these fields, but I want to format page in custom mode.

How can I get field info in order to use correct values? Thanks!

Source Link

How I use fields on a custom template?

I'm attempting to build custom template for specific content type. So, I created node--my-content-type.tpl.php and tried to write some text: it works! Ok, now I want to render my fields. I have $content['field_title'], field_author, field_cast (is a field collection) etc. I need values of these fields, so I tried to assign some variables: $title = $content['field_title']['value'] etc, but it doesn't seem to work. I can only call render function to render these fields, but I want to formt page in custom mode. How can I get field info in order to use correct values? Thanks!