0

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']['#value'];?>

Now im going to remove the print content bit from my node.tpl but that will mean no video.

could anyone advise on how to display the video field?

Im presumming i need to add some code which shows the fields and then print out the field.

This is where i am stuck.

thanks

(drupal 6)

  • ive added this to my template file function YOURTHEME_preprocess_node(&$vars) { var_dump($vars['template_files']); //dsm($vars['template_files']); // if devel module installed } but its only returning ... (Array, 1 element) 0 (String, 9 characters ) node-vids – Reg Gordon Jan 1 '13 at 19:43
  • i think im getting there. the field is field_videourl. ive tried printing it with <?php print render($content['field_videourl']); ?> but thats displaying errors. maybe thats d7 stuff – Reg Gordon Jan 1 '13 at 19:51
  • <?php print_r($node) ?> gives me this output but im still struggling to print the [field_videourl] => Array ( [0] => Array ( [embed] =>........ – Reg Gordon Jan 1 '13 at 20:09
  • bingo got there with <?php print $node->field_videourl[0]['view'] ?> – Reg Gordon Jan 1 '13 at 20:43
1

In D6 / CCK, assuming the field is set to display, you can simply use:

print $FIELD_NAME_rendered;

i.e:

print $field_videourl_rendered;

in node.tpl.php

| improve this answer | |
1

Instead of print_r try:

<?php print var_dump($node);?> 

Look at your source, find the video field you've setup, then copy and paste the complete path the the CCK variable you've setup. The problem is your outputting the entire body field where as it sounds like you just need two fields "$node->title" and "$node->MyVideoField" but without knowing the complete variable path I can't really help.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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