Posted by danshaw on December 8, 2012 at 6:07pm
I'm struggling to find an answer on how to add text on the same line as a printed php variable in my Drupal site. I've created a new content type and then added a new variable called 'field_duration'. In my node.tpl.php I want to add some text around the variable like you see below, but it keeps outputting the output in a block. So there is a 'carriage return' before and after.
Time:<?php print render($content['field_duration']); ?>minutes
I get:
Time:
5
minutes
Anyway to get it to be "Time: 5 minutes"?
Thanks!
Comments
=-=
inspect the HTML and see what classes or ID's are available. One method would be to use floats to get the output inline. Else, I'd research the possibilities of preprocessing the data or perhaps a custom tpl.php file for the field itself.
That did the trick!
Perfect VM. I wrapped each component in div's and floated them left. With a couple other little adjustments I made it work. Thanks for the help!