Question

I got the following notices and would like to clarify:

Notice: Undefined offset: 0 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434 

Notice: Undefined offset: 1 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434 

Notice: Undefined offset: 2 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434  

Notice: Undefined offset: 9 in /homepages/40/d35550088/htdocs/smarty/templates_c/
ef666588706a0451c86287e631024054e2f40226.file.list.tpl.php on line 434 

Code lines in the compiled tpl are:

<?php if ($_smarty_tpl->tpl_vars['TablesLinked']->value[$_smarty_tpl->getVariable('smarty')->value['section']['i']['index']]){?>

This is the uncompiled line:

{if $TablesLinked[i]}

One line above starts the section:

{section name=i loop=$NumberFields}

Do I have to change the start index because offset means wrong index ? TablesLinked does not appear in every field, because fields consist of linkedtables and normal fields, thats why I use an if-clause.

I hope you can help.

Était-ce utile?

La solution

Although it is a very good practice set error_reporting to E_ALL during development phase and trying to eliminate all notices, personally I wouldn't worry about these messages. It just won't find the elements on the specified indices during the loop. In any case, if you insist on eliminating the notices, you can change

{if $TablesLinked[i]}

to

{if isset($TablesLinked[i]) && $TablesLinked[i]}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top