Home > fields > Field variable customization in node.tpl.php

Field variable customization in node.tpl.php

November 7Hits:7
Advertisement

i have a website in which i am building a custom node page: node--coupon.tpl.php in which i want to render the body field only for which i used

print render($content['body']);

The result is shown as "BODY: this is my text".

but i want to use only 'this is my text' which is entered at the time of making a new custom content type of coupon.

is it possible to do so anyhow?

Answers

If you want to hide the label, go to Admin > Structure > Content types > Coupon > Manage display.

Using render function will always render the whole stuff. Print the exact variable that contains the body content. If you are aware of Devel module, it will hep you to find the exact variable.

For example, something like print $node->body['und'][0]['value']; will do the stuff.Sure it will include the html tags ( if made entry ).

Tags:fields

Related Articles

  • Field variable customization in node.tpl.phpNovember 7

    i have a website in which i am building a custom node page: node--coupon.tpl.php in which i want to render the body field only for which i used print render($content['body']); The result is shown as "BODY: this is my text". but i want to use onl

  • Undefined variable error in node.tpl.phpApril 23

    I'm using the Basic theme, and I get the following error when I refresh my site. Notice: Undefined variable: unpublished in include() (line 18 of /Users/me/Projects/mysite/httdocs/sites/all/themes/mytheme/templates/node.tpl.php). The line that is cau

  • Field collection with condition node tplJuly 31

    I've been researching this for the last few days and I cant find a clear explanation of this issue im facing. I'm receiving an error when a node has an empty collection with no values. The collection field: field_window_shade The fields within the co

  • Can I call specific fields and field groups in a node.tpl using AjaxAugust 26

    I'm building a fairly large content type and some of what's in there doesn't need to be loaded until the user asks for it. Is it possible to not load certain fields and field groups in the content type at first, but have them load via ajax and how wo

  • printing file entity fields in a node.tplApril 29

    I have some fields in a file entity type. Now I need to print some of these fields directly in a node.tpl. How can I do this? --------------Solutions------------- You could do this in a variety of ways. One way: in template.php, invoke YOURTHEME_prep

  • The purpose of $page in node.tpl.php and when does it become FALSE?January 29

    I noticed that there is a variable $page in node.tpl.php and it is usually TRUE. The node title is not displayed while it is TRUE, but in page.tpl.php, the node title has been displayed as a page title. The below is the code snippet from node.tpl.php

  • how do i create a new link in node.tpl.php by preprocess function in drupal?July 7

    I have content type in which I have two or three links .In node.tpl.php, all links are displaying from a single variable "$links" in node.tpl.php. i want to remove one particular link from the "$links" variable by preprocess function a

  • How can I detect if node is the last one from within node.tpl.php?September 7

    There are a number of variables for the node.tpl.php template, like $id that contains the current nodes index number, but how can I figure out if the current node is the last index or how many nodes there are in the current listing? (I'm using Drupal

  • Getting field labels from the $node variableJuly 20

    How can I get the labels of specific fields within a node, in Drupal 7? The field for which I am interested has the following structure: [field_text_question1] => Array( [und] => Array( [0] => Array( [value] => Sales Intern [format] => [saf

  • Translating fields in node.tpl.php file with drupal 7December 27

    I have a drupal English/French website. I have a custom content type called 'ad' with all sort of fields. I have created the file 'node--ad.tpl.php' in my theme directory to customize the display of the 'ad' content. I use pixture reloaded theme and

  • How to print fields in node.tpl.php?May 3

    I need to print individual fields from the $content variable in node.tpl.php file in separate div tags. How do I do that and how do I find out what the field's names are? --------------Solutions------------- Try this <?php print render($content['your

  • How can I print something only when cck field has certain value on node.tpl.php?June 20

    I need to print something conditionally in my node.tpl.php depending on the cck value of a field on my content type. For example, if field_color has "red" or "blue", then print "It has color" and if it has other values print

  • node.tpl render field from referenced entityJuly 3

    I have a node.tpl.php file where I need to output a field from an entity referenced via the entity module (a reference field). I have tried using: print render($content['field_parent']['#items'][0]['entity']->field_main_image); but nothing appears! I

  • how to get a node field value in a html.tpl.php template file?

    how to get a node field value in a html.tpl.php template file?August 1

    I have a field in a node type called body_styles. I need to modify html.tpl.php to get the value of body_styles to add it to the classes of the body tag. I tried with dpm($node->content['body_styles']['#value']); but I get nothing. I think it is beca

  • Print Emvideo Field in node.tplJanuary 1

    Hello im playing about with my node.tpl so as i can show the title of a video below the video ala youtube. Ive managed to sort that ok but my body field was showing above the title still so i rectified that with <?php print $node->content['body']['#

  • Change the Order of Fields on Teaser node.tplMay 7

    Hello i am struggling here a bit to change the display of my node teasers. I was hoping to take the title and submitted part and put it on top of my body field to the right of my teaser image. Ive tried Panelizer (looks great but the image field stay

  • Question regarding rendering fields in node.tpl.phpMay 25

    I'm confused in how the fields can be rendered. There are 2 variables in node.tpl.php $node and $content, both of which contain fields. My task was to render all fields separately, to surround them with custom html. First I've tried print render($con

  • Node.tpl.php file: Check is several fields are emptyMarch 28

    On my node, I have three location fields (primary, secondary, code) and three object fields (food, fuel, accommodation). I want my node.tp.php to check if all the location fields are empty or if all the object fields are empty and then print a messag

  • Field in custom node tpl - Simple issue that this newb can't figure out

    Field in custom node tpl - Simple issue that this newb can't figure outSeptember 12

    I am really hoping someone can help me out with this, the drupal.org forums are a complete ghost town. I have been spending a lot of time trying to learn the ins and outs of hooks and basic theming in Drupal. I currently have a template file for one

  • access node field variables in theming view-fieldMay 4

    How can I access a filed value of the node that I don't want to display in the view, is there any way to pass the field variable in $fields using view but not include it in display, I'm just want to use this field for checking a condition. ----------

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 17 q. 0.594 s.