I haven't seen any other talk of this elsewhere and, to be honest, I'm surprised no one else has brought it up. If they have, please mark this as duplicate and link to it. Here's the issue I see:
Both page.tpl.php and node.tpl.php use a variable called $content. Because of the fact that they're named the same, someone not familiar with Drupal might (reasonably) assume that they contain the same information. But, as we all know...they don't.
I'm recommending that the variable in node.tpl.php that is currently named $content is renamed. My thought would be to $node_content or something similar.
Is there a reason they're named the same thing? And if not, shouldn't they be changed? I look forward to hearing your thoughts.
Comments
Comment #1
ultimateboy commentedI think that $content is very ambiguous. $content also appears in the comment, maintenance page, and box templates. So I would tend to agree with renaming the vars to be more descriptive.
However, after thinking a bit more, it is pretty odd that we pass the entire $block object to the block template and yet we pass strings to the other template files. Is there reasoning behind this inconsistency?
Comment #2
Rob_Feature commentedRequesting a change to variable names for D7...
Comment #3
robloachI'd like to see what everyone else things of this. It makes sense from the backend ($comment->content, $node->content), but ends up being a bit confusing when we get into theming layer where everything just becomes a $content variable.
Comment #4
tr commentedComment #5
xjm(Merging "node system" and "node.module" components for 8.x; disregard.)
Comment #17
quietone commentedWhat I think are the relevant twig templates (page.html.twig and node.html.twig) include explanations of 'content' in the documentation. Therefor I am closing this as outdated.
Comment #18
quietone commented