Fridolin SOMERS
2021-05-07 07:17:58 UTC
Hi community,
I've been on a mindblowing search on a template error :D
I was thinking that "loop.count" was wrong for testing if loop is not
empty, the method is "loop.size".
See doc
http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH
So using count seems to work because it starts with 1.
But in my opinion it is a wrong call.
We can see for example :
<a href="#images">Images ([% localimages.count || 0 | html %])</a>
This is wrong no ?
Should be create a coding guideline ?
--
Fridolin SOMERS <***@biblibre.com>
Software and system maintainer 🦄
BibLibre, France
_______________________________________________
Koha-devel mailing list
Koha-***@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https:/
I've been on a mindblowing search on a template error :D
I was thinking that "loop.count" was wrong for testing if loop is not
empty, the method is "loop.size".
See doc
http://template-toolkit.org/docs/manual/Directives.html#section_FOREACH
git grep 'IF.*\.count ' origin/master | wc -l
602git grep 'IF.*\.size ' origin/master | wc -l
1636So using count seems to work because it starts with 1.
But in my opinion it is a wrong call.
We can see for example :
<a href="#images">Images ([% localimages.count || 0 | html %])</a>
This is wrong no ?
Should be create a coding guideline ?
--
Fridolin SOMERS <***@biblibre.com>
Software and system maintainer 🦄
BibLibre, France
_______________________________________________
Koha-devel mailing list
Koha-***@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https:/