0

In my D7 site, I have a content type that's being displayed using Content Template (Contemplate). The Content Template code hasn't changed in over a year. It's been running like a champ… displaying new content and edited content on hundreds of nodes.

All of a sudden, no new node content will be displayed through Content Template. If I temporarily disable the Content Template, the node content will appear. When I turn it back on, nothing.

I wiped out my Content Template code thinking there might be some conflict in there. I replaced the whole thing with just one line:

<?php print $node->field_body[$node->language][0]['safe_value']; ?>

Nothing.

What's interesting is that any HTML or PHP in the Content Template code will still work… it's just the field variables that are not producing any values. And again, this is only for newly created nodes.

Some of the core node variables will still work (like NID and Title), but none of the custom fields. So, for example, this code works:

<p>node: <?php print $node->nid ?></p>
<p>title: <?php print $node->title ?></p>

This would produce the NID and the node title successfully on the page. But, the aforementioned $node->field_body… (which is a custom field), produces nothing.

In a further effort to troubleshoot, I've disable any recently activated modules (Entityforms and Rules). No change.

1 Answer 1

0

The module's page explicitly states:

NOTE: This module may be deprecated in Drupal 7! Here's your reason, basically the theming changes in D7 mean the field theming gets bound a lot lot later in the process, so it's not possible to generate the output into a Textarea for you to edit

In fact the module has been marked as deprecated and not updated since 20 September 2011.

Also there is a long discussion on https://www.drupal.org/node/1285558 about better ways of doing things without Contemplate module.

So it's just time for you to give up the deprecated module and re-code your template files as it simply won't work with later versions of Drupal 7.

9
  • Sure. But, unfortunately, that's not an option for me. As a working developer, I'm sure you know that sometimes you just have to work with what you have. Again, everything else is working, but not new nodes. That's the part that I'm trying to troubleshoot here.
    – Sam
    Commented Mar 23, 2018 at 12:26
  • Lot has changed since 2011, so I am afraid it won't just work. Probably even your old nodes, which you claim are still displaying correctly, would break if you try to re-save them. So it's really not a good option to leave your website shaky like that.
    – AltaGrade
    Commented Mar 23, 2018 at 12:39
  • I don't disagree with you, but like I said, sometimes you just don't have the luxury of rebuilding. I did just double-check; the old nodes are working fine with any new edits.
    – Sam
    Commented Mar 23, 2018 at 12:43
  • So then output dpm($content) on the old working one and the new failing one and try to figure out what's the difference.
    – AltaGrade
    Commented Mar 23, 2018 at 12:44
  • Good idea. Interestingly, both produce an empty <pre></pre> tag.
    – Sam
    Commented Mar 23, 2018 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.