By hulfy on
Hi,
I am trying to arrange the output of my $content variable, there is a bunch of stuff in there page body, a title, a submenu.
Firstly I need to find out what is in $content variable, (I tried var_dump which gives me - string 628). Then I could like to know how to arrange the order they are displayed on screen and how to add classes or wrap them in divs of possible.
Thanks for your help.
H.
Comments
It depends what you're trying to do
The $content variable is just a string containing the output of the current page.
If you're trying to change the order of content in a specific node, you will just want to edit that specific node.
If you're trying to arrange posts on a page, you will want to look into Views.
what is in content
How do I debug this by outputting it on the screen, so I know variables I have?
fire up the devel module and
fire up the devel module and look at your node's "dev load" and "dev render" tabs to see what node variables you can use in your theme.
the nice thing about $content, though, is that Drupal has done all of the security and display pre-processing for you. if you start pulling out individual fields to display in your node, be sure you understand the security implications, and how to use functions like check_markup.
hth!
Could you elaborate more on
Could you elaborate more on this please? I've been trying to manually display what the $content variable spits out but I'm getting now where. I've created the node.tpl.php for the node that I'm trying to customize and I have the Devel module running.
I can't make sense of what the Devel module is showing me; nothing is labeled and I've tried a few things but I'm still lost.
thanks much,
d.
sure. in your node -> Devel
sure. in your node -> Devel -> Dev Render you'll see all of the node's data, ready for display. to print an individual field, use something like this in your node template:
make sure to read up on check_plain and check_markup.
hth!