rejetto forum

Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on February 04, 2010, 09:18:20 PM

Title: after the end, and special:end
Post by: Mars on February 04, 2010, 09:18:20 PM
 There is already of it certain time, rejetto created, further to my request, one macro 'AFTER THE LIST'.
 On the same principle, I decided to add a macro one named 'AFTER THE END'. and a new section [special:end]  which is the opposite of [special:begin] ;)

Quote

....

type
  TmacroData = record
    cd: TconnData;
    tpl: Ttpl;
    folder, f: Tfile;
    afterTheList, afterTheEnd, archiveAvailable, hideExt: boolean;
    aliases: THashedStringList;
    table: TStringDynArray;
    end;

.........

    if name = 'after the list' then
      if md.afterTheList then
        result:=macroDequote(p)
      else
        result:=MARKER_OPEN+fullMacro+MARKER_CLOSE;

    if name = 'after the end' then
      if md.afterTheEnd then
        result:=macroDequote(p)
      else
        result:=MARKER_OPEN+fullMacro+MARKER_CLOSE;

    if name = 'breadcrumbs' then
      breadcrumbs();
........

  result:=diffTpl[''];
  md.f:=NIL;
  md.afterTheList:=TRUE;
  try tryApplyMacrosAndSymbols(result, md)
  finally md.afterTheList:=FALSE end;
 // here is apply the macro 'after the list'
  md.afterTheEnd:=TRUE;
  try tryApplyMacrosAndSymbols(result, md)
  finally end;

  applySequential();

// it is important to put the section 'special:end' here
  list:=diffTpl['special:end'];
  try tryApplyMacrosAndSymbols(list, md)
  finally end;

  // ensure this is the last symbol to be translated
  result:=xtpl(result, [
//removed    '\n', CRLF,
    '%build-time%', floatToStrF((now()-buildTime)*SECONDS, ffFixed, 7,3)
  ]);
finally
  folder.unlock();
  diffTpl.free;
  end;
end; // getFolderPage

'after the end' and 'special:end' seem capable of making the same work, the first one allows a job giving result on the web page, whereas the last one serves to make invisible actions at the end of section.

usage: {.after the end|{:  ______   :}.}

example with a diff template on a virtual folder

Quote
%sequential%
{.after the end|{:max={.^max.}  {.set|max|-9999.}:}.}
{.set|max|1000.}

%sequential%
max={.^max.}
{.inc|max|500.}

%sequential%
{.after the end|{:max={.^max.}:}.}

%sequential%
max={.^max.}
{.inc|max|1000.}

1
max=2500

2
max=1000

3
max=-9999

4
max=1500



Title: Re: after the end, and special:end
Post by: rejetto on February 10, 2010, 12:13:48 AM
i guess you made these things because you faced impossibility at making something you needed. isn't it?
would you please tell me this real case instead?