I want to theme my webform using the node--9.tpl.php file, because I want two columns for the body and the form itself. But even using print_r I can't figure out what code I need to print out the form itself?

I use this for the body:
print render($content['body']);

Can anyone shed some light?

Comments

quicksketch’s picture

You shouldn't be trying to guess where the variables are. Install devel module, then click on the "Devel" tab on the node. Then you can see where everything is inside the node object and you can find the right part to print out.

adx’s picture

Hah, so much for scanning the contents of print_r - Devel is so easy!

Thanks :) For the interested, the code was simply:

print render($content['webform']); 
quicksketch’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tike012’s picture

Status: Closed (fixed) » Active

I am trying to embed just the form from a webform onto another page. I'm not sure I am approaching the problem correctly. I've started out with this:

  $email_form = node_load(13157); 

Now using

  print render(node_view($email_form, false, true));

will print the node in its entirety. Using dsm($email_form) to view the structure of the object reveals several levels of arrays, the most interesting ones being webform, ['components'], and [1]. However, no combination of code that I've tried will successfully print out the form, or any subset of the $email_form variable, for that matter.

Using print render($content['webform']) gives me an error; I think it should be print render($content->webform) but that doesn't print anything meaningful either.

I hope nobody minds if I re-open this ticket, as I've searched Google thoroughly and haven't found a clear solution to this problem. Thanks.

vernond’s picture

Status: Active » Closed (won't fix)

Your query is out of scope for the Webform issue queue as it fall under the heading of custom coding.

Try the devel module as recommended in #1 or general forums or irc.