I have downloaded Views 6.x-2.2 and was starting to create my first view. I set the format to be HTML list and then when I click on Theme:Information I get the error views-view-list.tpl.php (File not found, in folder ./). I checked the directory that views-view.tpl.php and views-view-fields.tpl.php are in to make sure it was there as they came up bold as they should have. The file is there, but it is not finding it. I also tried copying the file and placing it inside my theme and then rescaned the template folders with no luck. Does any one have any ideas. Thanks in advance.

CommentFileSizeAuthor
#4 view-export.txt4.19 KBaangel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SnowB1’s picture

I am also getting the error - An error occurred at /admin/build/views/ajax/preview/news_archive. I found a post that said you just need to change your data value in the table views_object_cache to the longblob type. I have done this, deleted the view and started over and get the same error. Any help would again be appreciated.

dawehner’s picture

Can you try to reproduce it with the latest views version?

Aniara.io’s picture

Version: 6.x-2.2 » 6.x-2.7

I'm getting these warning messages when accessing the Theme Information for any view on 2.7 that has a page display with a path under /admin/xxx, all default templates are marked in red and can't seem to be overridden by any matching template. For other views I'm not getting any of these warnings.

aangel’s picture

FileSize
4.19 KB

I'm getting the error:
"views-view.tpl.php (File not found, in folder sites/all/modules/contributed/date/)"

Exported view attached, in case that helps.

This is with drupal 6.14, cck 2.6, views 2.7

merlinofchaos’s picture

That looks like a date.module bug

aangel’s picture

Perhaps, or in the interface between the two modules.

Either way it's a showstopper for me. The template that's being returned is:
sites/all/modules/contributed/date/views-view.tpl.php

which, unfortunately, doesn't exist.

aangel’s picture

I tried to get to the bottom of the error but my debugger is throwing an exception on an include ("can't redeclare xxxx") so I am forced to go for the workaround.

What I think I saw happening was views_views['path'] in the theme registry was being filled with sites/all/modules/contributed/date. I couldn't narrow down if it was being set initially that way or whether it was being overwritten later (presumably by the date module). I suspect the later since disabling the date module gives a perfectly fine theme registry entry (i.e. path points to the views module directory).

Creating a views-view--myviewname.tpl.php got me around this problem, though. I don't use it but for now it needs to be there.

luthien’s picture

clearing cache fixed the error I got after creating views-view--myviewname.tpl.php within my theme.

JeremyFrench’s picture

I am not quite sure where the error lies, but I had a similar error when trying to add a hook_theme function to add templates to my view from the documentation here http://views-help.doc.logrus.com/help/views/api-default-views

<?php
function mymodule_theme($existing) {
  return array(
    'views_view__viewname_displayid' => array (
      'arguments' => array('view' => NULL),
      'template' => 'views-view--viewname--displayid',
      'original hook' => 'views_view',
    ),
  );
}
?>

I had to add a line

<?php
   'path' => 'path' => drupal_get_path('module', 'ec_blogs'),
?>

to the array for it to find the template.

I don't know if this is an issue with views, the templating system or the documentation.

Yas375’s picture

I had the same problem when I using my custom theme on drupal 6.16 and views 6.x.2.8 (i'm not using date module).

If i change in scan options in views theme to garland I see, that all is ok. Then I look to my template.php in my custom theme and found there next mistake:

/**
 * Implementation of HOOK_theme().
 */
function tstheme_theme(&$existing, $type, $theme, $path) {
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */
  // @TODO: Needs detailed comments. Patches welcome!
  return $hooks;
}

I create my custom theme from zen, but alone, without zen, but with some code snippets from here. I remove this function because i dont't defined here $hooks but using this. After this all become ok.

Totally: if you have the same error, then first thing what you should done is clear your template.php
---
best regards,
Victor Ilyukevich, aKa yas

esmerel’s picture

Status: Active » Postponed (maintainer needs more info)

Ok, there's been a couple of new versions of views since this. Is it still a problem?

Yuri’s picture

In my case (views 6.x-2.11) this error message appeared also. When I looked at the filename that was mentioned in the error message, it appeared that views automatically replaced the underscores in my views template file name by minus signs. Renaming the view 'resolved' this.

merlinofchaos’s picture

The theme system does this; _ are automatically translated to -.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gastonia’s picture

Albeit a bit late, I know why this is happening.

I first tried to theme views output by using the candidate theme function in my template.php file. I wasn't getting the result I wanted, so I then tried to create a template file of the same name to modify the raw data before it was stored in the $output variable.

Because I did not remove the function from my template.php file, the views module would not see that I had a correctly named .tpl.php file.

In other words, if you're getting this error, make sure you don't have a function in the template.php file of the same name as the template (.tpl.php) file.

Blue

http://gastonia.com

Ölbaum’s picture

Status: Closed (fixed) » Active

Yes, it is still a problem.

Ölbaum’s picture

More info:

The “advanced” help says:

function mymodule_theme($existing) {
  return array(
    'views_view__viewname__displayid' => array (
      'arguments' => array('view' => NULL),
      'template' => 'views-view--viewname--displayid',
      'original hook' => 'views_view',
      'path' => drupal_get_path('module', 'mymodule'),
    ),
  );
}

yet function format_themes($themes) in plugins/views_plugin_display.inc does not use the template key whatsoever:

$template = strtr($theme, '_', '-') . $extension;

Also, unless there is a key for views_view__viewname__displayid in the theme registry, Views only searches for templates in the Drupal root (where they will never be):

$template_path = isset($registry[$theme]['path']) ? $registry[$theme]['path'] . '/' : './';

I am new to the Drupal theme registry, but this doesn’t look to make any sense. function format_themes($themes) is looping over themes, doesn’t it mean that it looks at what components (modules, themes) provide templates for the current view element? I.e. module mymodule provides a template for views-view--viewname--displayid, and maybe theme timi overrides it. Then shouldn’t the theme key in mymodule_theme($existing) be

  return array(
    'mymodule' => array (
      'arguments' => array('view' => NULL),
      'template' => 'views-view--viewname--displayid',
    ...

and the template actually be used to specify the template provided?

Finally, if I add an entry to the theme registry so that function format_themes($themes) finds my template:

function mymodule_theme_registry_alter(&$theme_registry) {
 $theme_registry['views_view__viewname__displayid']['path'] = drupal_get_path('module', 'mymodule') . '/themes';
}

then the views-view--viewname--displayid.tpl.php (File not found, in folder ./) error disappears, but when I preview the view, I get errors:

  • warning: include(./sites/all/modules/mymodule/themes/sites/all/modules/mymodule/themes/views-view--viewname--displayid.tpl.php) [function.include]: failed to open stream: No such file or directory in /***/includes/theme.inc on line 1066.
  • warning: include() [function.include]: Failed opening './sites/all/modules/mymodule/themes/sites/all/modules/mymodule/themesviews-view--viewname--displayid.tpl.php' for inclusion (include_path='.:/***') in /***/includes/theme.inc on line 1066.

So there are definitely several things that go wrong here.

merlinofchaos’s picture

Ok, certainly it looks like using $registry[$theme]['template'] would be an improvement, if it's available. It certainly seems like it should be.

As for the 'path' thing you're showing, somehow the path is getting added to the default path. I don't immediately see how that can happen. You can look into theme.inc and look for $template_file and $render_function and see what's actually going on there, I guess, but you're in core code. Even though I wrote that code, it's been several years now.

I do know that when using the alter function, things are very fragile at that point since it's already done all the discovery it's going to do, and everything has to be exact already because it believes everything is as it should be.

held69’s picture

Getting the (File not found, in folder ./), error as well.

Using views 6.x-2.11
Trying to add a variable.
However couldn't prevent the advice of comment#16

In other words, if you're getting this error, make sure you don't have a function in the template.php file of the same name as the template (.tpl.php) file.

Is there an alternative for this to prevent (file not found) error?

sushantpaste’s picture

Try this to avoid (File not found, in folder ./) error.

THEMENAME_views_view_field__VIEWID__DISPLAY__FIELDNAME($vars){
 //some stuff
}

Hth

blakefrederick’s picture

Issue summary: View changes

For me the issue was the devel module. After I disabled it, the template files were found again.

I found this solution in a newer Drupal thread about Views 7.x-3.7: https://drupal.org/node/2042937

This may be helpful for solving the issue with Views 6.x-2.7.

theplanets’s picture

Solution for me was #22 as well. That Devel module has gotten buggy since drupal 6.

Chris Matthews’s picture

Status: Active » Closed (outdated)

The Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue