rejetto forum

Macros

Mars · 231 · 81884

0 Members and 1 Guest are viewing this topic.

Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
The below macro is from my templates. filesize only works with system directories, not with URL, so to do what you ask I am unsure. Unless it is a real folder of course. Then just put the name of the file in the if NAME.

{.if|{.filesize|%folder-resource%\NAME.}
  |DO THIS
  |DO THIS
.}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile

Offline Andrew-Sirius

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
The below macro is from my templates. filesize only works with system directories, not with URL, so to do what you ask I am unsure. Unless it is a real folder of course. Then just put the name of the file in the if NAME.

{.if|{.filesize|%folder-resource%\NAME.}
  |DO THIS
  |DO THIS
.}

Thanks! Now everything works! I'm so happy!!!


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1986
    • View Profile
Quote
{.if|{.filesize|%folder-resource%\NAME.}
  |DO THIS
  |DO THIS
.}


it will support URIs in next beta

Useful idea, but you should not forget that to know the   URL-file size it is necessary to load him, what can be long with some GBytes and only for detecter its existence,
A solution would be a macro {.file exist | URLNAME.} or  {. get |can download| URLNAME.}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
no.
local URIs are just converted to local file paths.
URLs instead are a way slower of course, but it doesn't depend on the size of the file, it's just a request for information to the server.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1986
    • View Profile
From a post of TSG
Quote
REQUIRES HFS BETA 183 or RECENT BUILD - http://www.rejetto.com/forum/index.php?board=33.0

I propose a macro short story whoever warned the administrator the used template requires a minimal version of hfs

{.min build|183.}

Code: [Select]
  if (name ='min build') then
    if addressmatch('127.0.0.1',md.cd.conn.address) then
       msgdlg('This template requires at least the build version '+p+' of hfs to work completely')
    else result:='';



Offline Andrew-Sirius

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Useful idea, but you should not forget that to know the   URL-file size it is necessary to load him, what can be long with some GBytes and only for detecter its existence,
A solution would be a macro {.file exist | URLNAME.} or  {. get |can download| URLNAME.}

No, it does not work. Nevertheless, the file, which is checked, must load


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
I propose a macro short story whoever warned the administrator the used template requires a minimal version of hfs

you can already solve the problem {.if|{.%build% < 183.}| warning .}


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
I propose a macro short story whoever warned the administrator the used template requires a minimal version of hfs

you can already solve the problem {.if|{.%build% < 183.}| warning .}

I do not include this on purpose, basically I want all users of my templates beta testing, therefore finding a lot more bugs and creating a better template engine. Look how far HFS has come in the last 12 months :D! I like to think I am somewhat helpful to HFS and its community.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
sure you are, but i didn't understand the reason why you don't do that


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
Its another thing to update when releasing.
Its an extra thing for HFS to think about when generating the template.
If I'm gonna start making errors I may as well make errors for everything.
If the template is fucked it is obvious to upgrade HFS as...
I state it in the readme that they must upgrade their HFS.
I state it under the download links.

I think that's enough reasons :D.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
all your templates have a minimum number for the required build.
if you forget to update that number (that you can keep in the configuration on top) that won't break anything.
if your tpl requires 183, but for an error you are checking for the 181, it won't be worst than it is now.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1986
    • View Profile
I was writting when rejetto post before me....

The utility of such an action is to prevent the recursive questions on the use of new macros, which would provoke inevitably some bugs on new template with old version of HFS

Of more the solution of rejetto imply a message on the utilisteur, while I propose an alert at the level of hfs, what adorned me more logical, instead of testing templates from every angle and allowing to pass an error


I have already tested the solution of rejetto but it did not seem to me sufficient(self-important), where from my proposition of macro with a message of alert at the level of the server
« Last Edit: March 07, 2008, 11:54:35 AM by mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13271
    • View Profile
a macro to issue a warning message would be more flexible


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
I would prefer an alert from HFS as they import the template. Maybe something in [special:import].

[special:import]

{.if|{.BUILD_VAR=183.}|HFS ALERT INFORMATION.}

{.add folder|real|template.}
{.set item|/template|hide.}
{.set item|/template|no log.}

This way they are warned instantly. Instead of later, where they may just trust our builds to be stable and forget about testing it.