why do I receive wrong Notice: Undefined index? There is a view and content type both called activities and this is views-view-fields--activities--block.tpl.php

&lt;div class="element"&gt;
&lt;div class="image"&gt;&lt;?php print $fields['field_activities_image']-&gt;content;?&gt;&lt;/div&gt;
&lt;div class="text"&gt;
    &lt;div class="head"&gt;&lt;?php print $fields['field_activities_title']-&gt;content;?&gt;    &lt;/div&gt;
    &lt;div class="body"&gt;&lt;?php print $fields['field_activities_summary']-&gt;content;?&gt;    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;


this block is displayed in the front--page.tpl.php and it works right.
There is another block of this view and that block is displayed in the node page. this block only contains 10 title. the problem is drupal reports this warning in the node page:

Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_image in include() (line 2 of ...views-view-fields--activities--block.tpl.php)
Notice: Undefined index: field_activities_summary in include() (line 5 of ...views-view-fields--activities--block.tpl.php)


The ID of the block that is displayed in the node page is block_1 but it tries to use views-view-fields--activities--block.tpl.php. how can I solve this warning?
I think that the name views-view-fields--activities--block.tpl.php is a suggestion for all blocks of the view activities - to get better specified template name check template information in that view. ('Information' link under Other -> Theme in the view builder) I think that the template name should be something like views-view-fields--activities--[block_id].tpl.php.

Change the block machine name if necessary.

Also, its a good practice to utilise this in templates to prevent such warnings:

&lt;?php if (!empty($fields['field_activities_image'])):?&gt;
  &lt;div class="image"&gt;&lt;?php print $fields['field_activities_image']-&gt;content;?&gt;&lt;/div&gt;
&lt;?php endif; ?&gt;