eozzy
eozzy

Reputation: 68650

$content variable in node.tpl.php (Drupal 5)

The print $content statement in node.tpl.php is causing my whole layout to break probably due to incorrect nesting of DIVs.

I want to check and fix that but I can't figure out what/where is the source of the $content variable in node.tpl.php file.

I'd appreciate any help. Thanks.

Upvotes: 1

Views: 2262

Answers (5)

user83632
user83632

Reputation:

The $content is what is returned from hook_view()

If many nodes are affected it sounds like it could be a custom theme function that is causing the problems.

Upvotes: 0

ceejayoz
ceejayoz

Reputation: 179994

The $content variable in Drupal nodes doesn't come from any one place. All enabled modules are able to add, remove, and tweak the $content variable, using Drupal hooks like hook_nodeapi and hook_view.

Knowing what modules you have enabled and the exact HTML that's causing trouble may help people help you more. As-is, the answer to your question is "it depends".

Upvotes: 1

googletorp
googletorp

Reputation: 33265

$content is the variable that holds all the content. So it's difficult to pin point the exact location of the error with the nested divs.

However, the problem is most likely in a custom theme function located in your theme or a custom built module. Modules from d.o is usually free of such bugs, so hopefully you should be able to find the problem pretty quickly with the limited possibilities.

Another problem could be in the templates that's used to generate some of the content, again, you should only look at the custom made ones in your theme.

Upvotes: 2

Jeremy French
Jeremy French

Reputation: 12157

There is no one place which will be the source of $content it can contain generated content from just about anywhere.

A way to debug is to turn off modules until the problem goes away and then work out what in that module is causing the problem.

Upvotes: 1

Elzo Valugi
Elzo Valugi

Reputation: 27856

Try to use a debugger to see what contains the variable at a given time. If I remember correctly $content is the generated html content for the current node.

Upvotes: -1

Related Questions