0

I'm theming a block view that displays content that is related to the current node. When I preview the view results they show up fine, but the content doesn't render in my theme.

When I examined more, I noticed the views-view-unformatted template renders correctly and contains three rows as expected, but each of the rows just contains the value NULL.

The theme information tool in Views gives the following error regarding row style output:

Row style output: views-view-fields.tpl.php, views-view-fields--read-next.tpl.php, views-view-fields--default.tpl.php, views-view-fields--default.tpl.php, views-view-fields--block.tpl.php, views-view-fields--read-next--block.tpl.php (File not found, in folder ./)

I created the file views-view-fields--read-next--block.tpl.php with the following content:

<?php foreach ($fields as $id => $field): ?>
    <?php print $field->content; ?>
<?php endforeach; ?>

Unfortunately that did not help. The file is still not found and nothing is rendered. Other things I've tried:

  • Disabling devel_themer
  • Clearing all caches
  • Restarting Apache
  • Checking file permissions
  • Changing the view formatting back and forth a few times
  • Edit: Rescanning the template files

What can be the problem? I don't know where to look next. I'm using Views 7.x-3.10.

0

After creating a new tpl file for views to pick up you need to hit the button called " rescan template files" at the bottom of the window. So that your new tpl gets highlighted.

  • Thanks, but I forgot to mention I've rescanned the template files a couple of times between each of my solution attempts. – Kaivosukeltaja Mar 31 '15 at 8:52
0

I finally found out the cause of this - I had previously defined the function mytheme_views_view_fields__read_next__block() in template.php and forgot to return a value. Views module's theming information gives a confusing error message when templates are defined in template.php instead of the templates directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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