rejetto forum

about %files%

Mars · 6 · 3142

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
what think about this?

The section [no file] disappeared for the benefit of a simple variable in the default tpl.

By putting all the part < form > %list < / form > in the section [files], and by showing  the contents of an empty directory of the VFS, there is a small problem,

the macro {.if not| %number% | <div class='big'>{.!No files.}</div> | ......   can't work.


we must replace in main.pas the line

'%files%', if_(list='', diffTpl['nofiles'], diffTpl['files']),

by this

'%files%', diffTpl['files'],

or by the better line

'%files%', if_(list='', or_(diffTpl['nofiles'],'<div class="big">{.!No files.}</div>'), diffTpl['files']),

So in every case, we find a correct functioning of the tpl ;)
   
« Last Edit: November 22, 2008, 12:01:12 AM by mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
what think about this?

By putting all the part < form > %list < / form > in the section [files], and by showing  the contents of an empty directory of the VFS, there is a small problem,

sorry mars, i didn't understand the problem.
could you please attach a simple template and suggest how to reproduce the problem with it?


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
what think about this?

By putting all the part < form > %list < / form > in the section [files], and by showing  the contents of an empty directory of the VFS, there is a small problem,

sorry mars, i didn't understand the problem.
could you please attach a simple template and suggest how to reproduce the problem with it?

solution:
 replace

    '%files%', diffTpl['files'],

by

    '%files%', if_(list='', or_(diffTpl['nofiles'],'<div class="big">{.!No files.}</div>'), diffTpl['files']),

test the actual version with an empty folder and set the default template with this inside

Quote
....
%files%
.....

[files]
....
%list%
....

Make the modification '%files%',.. in main.pas, and you will see the difference. ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
mars, couldn't you just attach the modified template please? :)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
Quote
mars, couldn't you just attach the modified template please?


in this 'rejetto' template , i had moved the 'manage delete Form' to the section [files] and removed the  line beginning by {.if not | % number % |...  for more clarity  in the template, I thus had to put back  on the way a small defect which you had by-passed with this line. For my part I find more interesting to anticipate this state internally in hfs. Otherwise some could look for a long time for the solution of this problem.

Sorry, but I like quite particularly the section [files] because she allows to aerate the template, nd I think that this modification does not eat bread as we say. :D

Attached the file tpl culprit ;)
« Last Edit: November 29, 2008, 10:38:44 PM by mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
Ok, thank you for your patience, i finally got the point.
You misunderstood %files%.
It was created when there was no macro available, it was needed as an IF to go to [files] or [no files].

When you suggest to use this code
'%files%', diffTpl['files'],
you are removing the logic (the IF), thus removing any sense for its existence, breaking compatibility and making old templates not working.


When you suggest
'%files%', if_(list='', or_(diffTpl['nofiles'],'<div class="big">{.!No files.}</div>'), diffTpl['files']),
you are just adding a sort of default [no files] in case this section wouldn't exist.
But that html code is not general, it will work well if you are using the ver2.2 default template or a derived work, but in such case you will have [no files] as well.