By unxposed on
I want to print things like:
$field_image
$field_body
$field_description
in my tmeplate.
Which are normally all printed inside:
$content
What syntax do I need?
Thanks
I want to print things like:
$field_image
$field_body
$field_description
in my tmeplate.
Which are normally all printed inside:
$content
What syntax do I need?
Thanks
Comments
Use the $node object
If you want to print out variables in a node/content type, you can use the $node object, which has all your variables inside of it.
Use print_r($node) or dsm($node) (if you have the Devel module installed) from within your template file so you can see how to dial up your fields, then output them using print statements.
For example, if you have a textfield 'field_name', its structure inside the $node object might look something like this:
[field_name] => Array
(
[0] => Array
(
[value] => John
So you could print it using:
Thank you very very very
Thank you very very very much : ) I really needed that pointer.
Here's how I can now display the content on my Organic groups home pages:
Thanks again!
My thanks also
This was, indeed, a quick and clear solution to a specific question. =)
Just a follow up. If the field holds multiple values, the following code displays only one value, the first, because of '[0]'.
Is it possible to edit this to display all the values?
Hey, molave... I caught your
Hey, molave... I caught your thread here while searching for a way to display only specific pieces of data while avoiding the possibility of breaking the "Edit Page" capability... (You might check this as I've taken the approach outlines in this thread and found that I can no longer edit the page! Ha. I think it will be an easy fix, but if you're aware of what I'm referring to here, by all means, feel free to explain the solution.)
Anyway, you can output all values:
(Unless I'm mistaken, that is. ;.) )
Hope this helps and again, if you're in the privy of a solution to the problem I've mentioned above, please let me know. Us Drupal guys need to know when to reach out to our sleeper cells, ya know? ;.)
Is it possible with views output?
How do you do that with an output from views? I have a scenario where I'm using a list created from Nodequeue. It outputs both the title of a series of nodes and images in each node. But I want to put the titles in the left sidebar and the images in the center content area. Any advice?
Thanks!
Super delayed thanks
@Wolf_22
Thanks for the help with the syntax. It does the trick, all right. This notification slipped under my radar, because dude I'd never skip showing appreciation for a helping hand.
Cheers!