Hello,

I built a node template using Garland as the default theme during development. To start, I emptied the contents of Garland's node.tpl.php, wrote my new stuff in it, and put it back into the default Garland directory. This approach works fine, and when using Garland theme, my custom node type displays as it should.

Then when I was finally ready to move the files to the production server, I renamed it as "node-mycontenttype.tpl.php" and put it into the /sites/all/contemplates folder.

When I reloaded the page, where the content should've been, I only got "Array".

Then I tried renaming the template file to node-mycontenttype-body.tpl.php, and now I get nothing.

Has anyone seen this behavior before? How come it works as node.tpl.php inside Garland, but not as a Contemplate disk-based template?

One additional piece of information is that I'm doing a decent bit of preprocessing, wrapped up in a module that I wrote. Could it be that Contemplates and my new preprocessing module are clashing? If so, where/how should I debug? If it'd help, I'll post the template file I'm using.

Any clues/tips are much appreciated! Thanks!

Comments

narky’s picture

A little additional info:

I think, for whatever reason, there's a loop (infinite?) going on. I looked at the problem page's rendered HTML (using FF/Firebug), and it starts printing the node contents, but stops pretty much right after the first or second DIV. Then it begins looping.

With default Garland node.tpl.php, it should look as follows:

<div class="content clear-block">
  <div id="node-15" class="node">
  ...
  </div>
</div>

But, with the template in place and Contemplates switched on, it shows (double-spaced for readability):

<div class="clear-block"><!-- "content" is missing here -->

  <div id="node-15" class="node">

    <div class="content clear-block">

      <div id="node-15" class=" node"><!-- note the space in front of node -->

        <h2><a href="">Sample Title</a></h2><!-- why is this a link, going nowhere? -->

        <div class="content clear-block"><!-- here it goes again... -->

          <!-- nothing at all is printed here -->

        </div>
      </div>
    </div>
  </div>
</div>

From the looping going on, I'm beginning to think that it's perhaps my node template code that's the issue (I'm using a couple 'for' loops here and there). However, if that were true, why and how does it work just fine when the same code is used as the node.tpl.php inside a theme (Garland)? *confused*

Oh, and when I look at ../node/15/devel/load, everything is there, and looks fine. When I look at ../node/15/devel/render, and try to peek inside the $content, it takes an abnormal amount of time -- probably because of the looping fun. =(

narky’s picture

Component: Code » Miscellaneous

More info:

Changing module execution order for my custom modules didn't do anything. Contemplate's weight is set at 10. I tried running my modules at 0 (original weight), 9 (right before Contemplate), and 11 (right after Contemplate).

Anyone? Help? Any "gotchas" when using Contemplate with custom modules would be greatly appreciated, so I can somehow isolate the issue and take it from there.