rejetto forum

Default file mask to ~setting

Guest · 21 · 12234

0 Members and 1 Guest are viewing this topic.

Zean

  • Guest
Is there a way to change the default file mask for the server root "/" to something listed in the server's HTML template?

For example, If I created a new section called "[index]" and enter the html for my homepage and type ~index this page views as I'd like. However, If I make the default file mask for the root "~index" It's looking for an actual which it wont find so the root and all the folders are shown.

The reason I'm trying to do this is so I can use the server templates functions such as %timestamp%, %connections% where as I can't using an actual file.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
for now you can
1. put the content of [index] at the top of the template (the main section, with no name)
2. select all folders
3. diff template, put the original content of the main section

it should work


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
Another approach could be: create two main sections, as follows.

Name the first one (for example) 'PageFiles' and copy there the content of your actual main body.

Create a second one 'PageHome' where you put the body of your home page.

Then in the original main section delete the content of body and put this:

{{if | {{=|%folder%|/|}} | {{section|PageHome}}  | {{section|PageFiles}} }}


So in PageHome you have all global hfs vars accessible (ip, speed-out,  user,conections...). Only add in your homepage a link (access to fileserver) to the mainfolder of your fileserver (something like '/root/' , not '/') ! You cant then let the users browse from '/' root, but you can put there more than one link to access: root for generic files, music for a tree with mp3, templates for a thread with templates and so on.
your computer has no brain - use your own !


Offline rejetto

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


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
By looking at this post, I wondered if it was possible to add the equivalent of
{{=|%folder%|/|}}
Quote
if name = '=' then
  trueIf(sameText(par(0), par(1)));


{{equal|%folder%|/|}}
Quote
if name = 'equal' then
  trueIf(sameText(par(0), par(1)));

{{=|'{{=|#|&}}'|''}}   The syntax is obviously of use to nothing but is correct and to decipher it is another story 

{{equal|'{{equal|#|&}}'|''}} is a little easier to follow

{{if|{{=|'{{=|#|&}}'|''}}|You win|You lose}} or {{if|{{equal|'{{equal|#|&}}'|''}}|You win|You lose}}


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
Thanks to you, Rejetto, because your macros allow to reduce the need of diff templates!

They are really usefull !

Only ... if we could find a way of evolution of RTL (Rejetto-Template-Language). Because the actual syntax - without trying to offend - is as useful as ugly. Now, a template is html (with optional java etc.) and embeded rtl, but complex macros are really difficult tu read.

RTL could progress to reverse: {rtl}{/rtl}  for macro text with simpler sintax, allowing {code}{/code} where resides standard browser language(html expressions), a section-name could directly be invoked (like named gosub). Mars says with enthusiasm... we will have something like old Basic. Also perhaps we do not need 'GOTO 2210' and no 'POKE's, rtl could be at least as readable as Basic. Without double braces, and without the first pipe character after macroname, we could already gain a lot. 

So templates would no longer be html with rejetto extensions, but a rtl-document that's used to create html.


your computer has no brain - use your own !


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
RTL
Quote
RTL (Rejetto-Template-Language).
It is the slow evolution or the migration towards the php ;D ;D


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
hehe, slow down guys :)
there's no point in creating a "full" new language.
even before CGI support i could add php support, but it's better to wait.
to have equal as alias for = it's ok, from next build.
to avoid the first separator | and have a space instead is apparently possible, BUT what if the first parameter need to be a blank space?


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
If first parameter is blank space: {quote  } or &nbsp.

... or: allowing inside macros a new sintax for {{ section | somesection}} like $somesection (or for Basic-preference somesection$ ), there could be some prefefined 'sepecial section' like $space (-> space$) ..

from:
{{if | {{=|%folder%|/|}} | {{section | PageHome}}  | {{ ifnot %user% | {{section|PageLogin}} | {{section|PageFiles }}}}}}

to:
{{if  {{equal %folder%|/|}} | $PageHome  | {{ ifnot %user% | $PageForceToLogin | $PageFiles }} }}

or inside rtl:
{rtl}
{$GetLangFromCookie}
{if {notequal %folder%|/|} | $BuildFoldertree }
...
{if {equal %folder%|/|} | $PageHome  | {ifnot %user% | $PageForceToLogin | $PageFiles }}
...
{/rtl}
your computer has no brain - use your own !


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
If first parameter is blank space: {quote  } or &nbsp.
"quote  " doesn't seem a good solution, and   would not work in many cases, like {{=}}

Quote
... or: allowing inside macros a new sintax for {{ section | somesection}} like $somesection

it's complex. i would try avoid introducing new special characters.
if %symbols% weren't there already, i would have used macros for all of them so that % was a normal char.
anyway, a possible solution is {{$name}} as alias for {{section|name}}.
if you like it i will introduce it in next build.
« Last Edit: December 05, 2007, 04:22:16 AM by rejetto »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
i worked out to get this working
{{ %folder% = / }}

with this one, i think we don't need the alias {{equal}} anymore ;)
Posted on: 05 December 2007, 05:22:42
just as for {{$section}} i could make {{?urlvar}} to have a shorter form in case this macro is very used. it's an idea.
anyway, characters like $ = and ? are few, and we should think twice before assigning them to a macro.


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
I think we could even still use %somesection% !
The confusion created would not be any greater than the difference between defined and intrinsic functions y most languages.

As there is no way to assign variables, the logigal conditional operations 'if' or 'if not' (what sould be 'ifnot' to simplyfy parsing) could turn to if = and if #

Also to avoid problems with a future 'if >' (if greater)  (example: {{ if > %secuential%| dosomething}} ) perhaps Mars idea to use words instead of signs (equal, notequal, greater, less..) would be better.

In any case, you are right, we should think twice about changes and new creations, and polish definitions before implementing, to have more consistent syntax and avoid some strange orders like in substring and cut. First parameter (as in most languages) the object to work with, then how -> substring "thestring", form where, towhere, like it's in repeat: repeat what, howmanytimes.

urlvar will be used a lot less than sections, and there is think it contributes to see where the value comes from, because there are no intrinsic values for %sort% etc. , and perhaps nobody includes a section with that name.
your computer has no brain - use your own !


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
As there is no way to assign variables, the logigal conditional operations 'if' or 'if not' (what sould be 'ifnot' to simplyfy parsing) could turn to if = and if #

yes, the if is a very frequent macro... but maybe it is already handy the way it is?

Quote
In any case, you are right, we should think twice about changes and new creations, and polish definitions before implementing, to have more consistent syntax and avoid some strange orders like in substring and cut. First parameter (as in most languages) the object to work with, then how -> substring "thestring", form where, towhere, like it's in repeat: repeat what, howmanytimes.

i often decide the order thinking on how big the parameters will be. E.g. substring, the first two parameters may be very much littler than the third. if a short parameter is after a long one, reading may be harder.
« Last Edit: December 05, 2007, 08:27:41 AM by rejetto »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile