Greetings,

I am getting the following notice with views isotope:

Notice: Undefined offset: 0 in include() (line 14 of /var/www/html/gems5/sites/all/modules/contrib/views_isotope/views-isotope.tpl.php).

Any ideas how to fix this? Cheers, Kevin

Comments

Funkwarrior’s picture

I've the same problem

zikaelismik’s picture

Same here
Mine is a view with term id contextual filter. But this error appears even in the example page.
I noticed the attribute data-category is empty on every element.

matt.elkins’s picture

Assigned: Unassigned » matt.elkins
matt.elkins’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for your posts! I'm struggling to reproduce this problem at the moment. From a clean install of the Isotope example feature, I had to do the following:

  1. Add terms to the 'Isotope sort options' vocabulary - I added 'Post date' and 'Title'.
  2. Add a taxonomy term reference field to the 'Article' content type - an autocomplete field that utilises the 'Tags' vocabulary.
  3. Publish a few articles, adding a few tags via the field created above.

After completing the three steps above, the Isotope grid on the example page was populated with the articles I'd published, and I was able to filter and sort them as expected.

In order for me to investigate further, would it be possible for you all to post features containing your implementation? I'm hoping that a simple misconfiguration is causing the problem. If you do choose to post a feature, please include all relevant views, content types and taxonomy vocabularies.

In the mean time, I'll keep experimenting to try and recreate the problem for myself. Thanks!

Funkwarrior’s picture

Hello,
Thanks Matt for your hard work.
On my side, I have the same error without using any filter, only with a view:

http://pastebin.com/K4FzLVx1

And there's my features file (hope I build it well): http://cl.ly/1t3e1R2Q461R

Thanks!

saturnine_nl’s picture

I have the same problem, except i know whats causing my problem.
I dont know why it occurs but it might help you in the right direction.

I created a content type with a few standard fields. I also added an images field,
with an unlimited amount as default. Each person i added with this content type has
5 pictures added. If i look with devel, on what is going on under the hood, they pop up.

field_profile_image (Array, 1 element)

und (Array, 5 elements)
0 (Array, 16 elements)
1 (Array, 16 elements)
2 (Array, 16 elements)
3 (Array, 16 elements)
4 (Array, 16 elements)

And thats where things tend to go wrong. I assume the first element stores
the number of pictures attached, wich makes sense for the error message,
its undefined. I hope this information helps you with solving this problem.

Greets Sat

tonygjerlufsen’s picture

I stumbled across this when I didn't add any filter classes on fields.
As I can see, views-isotope.tpl.php relies on filter classes being present (from lines 24-54 in views_isotope.theme.inc).
However, what if you simply would like to take advantage of the raw non-filtered Isotope functionality?

zakxxi’s picture

Same bug here… Any issue ?

Notice : Undefined offset: 0 dans include() (ligne 14 dans /var/www/drupal/sites/all/modules/views_isotope/views-isotope.tpl.php).

pyxio’s picture

i have discovered this not a bug in the module... it is just a very difficult module to configure. but when configured properly, there is no offset error. it is impossible to say where the configuration problem is in your case. Check out my post here to ensure you have properly configured the module https://drupal.org/node/1987912#comment-7442866

zakxxi’s picture

Yes, I think you're right, it's not a bug but a configuration problem… The module works with the example features. I dont understand why i have the offset error, the problem comes when I use a custom content type instead of Article, I clone the view and I think the config is OK.
How can you help me ?

There is 2 sceenshots :

EXAMPLE :
https://www.dropbox.com/s/bmqor8bgm79beju/Screenshot%202013-06-09%2014.0...

CUSTOM CONTENT TYPE / VOCABULARY :
https://www.dropbox.com/s/qmwkrs4iyscn6zl/Screenshot%202013-06-09%2014.0...

pyxio’s picture

you cloned the view. but did you change the vocabulary the field_tags is associated with? if it is still associated with tags somewhere you will have this problem. you need to check both the isotope view and the isotope filters view. somewhere, you have not specified the different vocabulary than the examples.

zakxxi’s picture

Finally I found the solution, thank you talengix for helping me, I just added a "security" on my view / filter criteria Content: Has taxonomy term (not empty)
And everything was fine.

https://www.dropbox.com/s/rcjw7uvforlruiz/1942898.png

pyxio’s picture

Hi zakxxi,

thank you very much for reporting back the solution... yes, this sounds exactly right and i included it now in my instructions above. if the term value is empty an offset error will occur! Duh! ;o) Hopefully this thread will be helpful to many people as on the surface it seems like a very difficult module to configure. But it really isn't if detailed instructions are troubleshooting tips are provided. Cheers Kevin

royerd’s picture

I'm getting this kind of error, trying to use the example. I simply don't understand the fix described above. Can you help? I pretty familiar with views, content types, fields, taxonomy, etc. I just don't understand how this error was fixed when I read the posts above. Any clarification?

royerd’s picture

Yes, I've been fighting with this and then saw your post #7 and added something other than the default class and the errors when away.

abailarri’s picture

StatusFileSize
new18.12 KB

Hello!

I'm getting the same error, but in my case, it's very strange, because only happens with some entries. Some entries have the clases, and other some entries not have the clases, and I don't understand why. I attaching a screenshot of my code.

Thanks!

PS: I'm using multiple taxonomy filters by following these steps: https://drupal.org/node/1958022#comment-7252784

rajmataj’s picture

Issue summary: View changes

This happened to me as well but the source of the problem was in the field settings for my taxonomy term. On the page view for your isotope, check: Fields > Content: [your-term], and then in the Style Settings area check the following settings:

  • Customize field HTML - checked
  • HTML Element: Div
  • CSS Class: isotope-filter
  • leave all other items in this section unchecked.

After saving, I had all my offset errors disappear. Hope that helps out others.

meanderix’s picture

I've been trying to debug this issue and I found that the error occurs when the $isotope_filter_classes array has not been assigned proper filter classes. This can occur if the current item does not have any taxonomy terms. A workaround is to add the following line to views_isotope.theme.inc:

      if (isset($row[$field])) {
        ...
      } else {
        $vars['isotope_filter_classes'][$index] = '';
      }
jmary’s picture

#17 did it for me.

tuthanh’s picture

I encountered this bug when making an Isotope View without a filter.

A work around is adding a field, exclude it from display and add the "isotope-filter" class for it.

shankar javali’s picture

This error may occurred, because of an wrong configuration, as i installed an tried to do configuration, the module works fine for me without an error, if u want u can follow the steps as in this video: "http://vimeo.com/40662343"

As i used the custom taxonomy terms instead of an tag terms.

N1ghteyes’s picture

this issue seems to be when not using filters. you can override the tpl file with the following.

Create a new file in your theme directory. name it views-isotope.tpl.php

Inside that file put the following (without the very first < ? php and last ? >):

<?php
<div id="isotope-container">
  <?php
    $count = 0;
    foreach ($rows as $row):
  ?>
    <div class="isotope-element <?php (isset($isotope_filter_classes[$count]) ? print $isotope_filter_classes[$count] : 0); ?>" data-category="<?php (isset($isotope_filter_classes[$count]) ? print $isotope_filter_classes[$count] : 0); ?>">
      <?php print $row; ?>
    </div>
  <?php
      $count++;
    endforeach;
  ?>
</div>
?>

save, and clear your cache.

This checks that the array position exists, if it does it will work as normal. If not, it prints a 0 to the end of the class name and stops the error.

alexmartin’s picture

The .tpl fix by N1ghteyes in #22 works for me. Thanks!

francoud’s picture

Workaround #20 workes for me. replacing the tpl as in #22 also works. Beware the code is a little wrong, there's a "

" inside the <?php in line 2. I tried this and works:

<?php
/**
 * replacement for @file views-isotope.tpl.php
 */
?>
<div id="isotope-container">
  <?php
    $count = 0;
    foreach ($rows as $row):
  ?>
    <div class="isotope-element <?php (isset($isotope_filter_classes[$count]) ? print $isotope_filter_classes[$count] : 0); ?>" data-category="<?php (isset($isotope_filter_classes[$count]) ? print $isotope_filter_classes[$count] : 0); ?>">
      <?php print $row; ?>
    </div>
  <?php
      $count++;
    endforeach;
  ?>
</div>


adeelnawaz’s picture

in my site we have multiple languages i am using node--custom.tpl.php file to select different languages some page pages have 3 languages and some have 2 languages problem is that when we move on page that have two language they give error on it but in 3 language page they work perfectly here is my code to get languages

$value1_node = ($content['field_translation']['#items'][0]['value']);
$value2_node = ($content['field_translation']['#items'][1]['value']);
$value3_node = ($content['field_translation']['#items'][2]['value']);

error on this line when we move on third languages
$value3_node = ($content['field_translation']['#items'][2]['value']);
undefined offset 2

Chris Gillis’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new680 bytes

If you have some nodes without associated terms, and error reporting on Strict, you will get notices. This patch fixes it.

Chris Gillis’s picture

Status: Needs review » Fixed

Fixed in 7.x-2.0-beta1.

Status: Fixed » Closed (fixed)

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