rejetto forum

Software => HTML & templates => HFS ~ HTTP File Server => RAWR-Designs => Topic started by: TSG on December 08, 2007, 12:42:59 PM

Title: New template in the works.
Post by: TSG on December 08, 2007, 12:42:59 PM
Just thought I'd post about the new template I'm working on.

It's a hybrid between ToG and Terayon with a completely new CSS and HTML code set. This one follows the colour scheme of our homepage and will be avaliable in a few other colour sets too, will just be a simple change of the CSS sheet.

It is nowhere near completion, but you can take a look. :o
Title: Re: New template in the works.
Post by: TSG on December 09, 2007, 01:51:47 PM
Alright i need help with some macro's here... rejetto, mars... time to use brains.

I am trying to make a check for an archive button on our new template.

{{if|{{get|%item-archive%}}|{{$archive-on}}|{{$archive-off}} /if}}

[item-archive]
true

[archive-on]
<div class="quickBtn1" onmouseover="onBtn(this)" onmouseout="offBtn(this)"><a href="%item-url%~folder.tar?recursive" title="Download the content of this folder as a .tar Archive"><img src="/template/images/Download.gif" alt="DL" align="middle"></a></div>

[archive-off]
<div class="quickBtn1 disabled" onmouseover="onBtn(this)" onmouseout="offBtn(this)"><img src="/template/images/Download.gif" alt="DL" align="middle"></div>

what am i doing wrong...
Title: Re: New template in the works.
Post by: rejetto on December 09, 2007, 07:33:32 PM
{{if|{{$%item-archive%}}| ...
Title: Re: New template in the works.
Post by: TSG on December 10, 2007, 04:26:22 AM
It works! But its backwards :P...

{{if|{{$%item-archive%}}|{{$archive-off}}|{{$archive-on}}/if}}

that does it correctly. even tho the logic appears to be reversed...
Title: Re: New template in the works.
Post by: TSG on December 10, 2007, 05:15:48 AM
Ok, i am trying use macro's throughout this template. Since i've heard that it is a faster system :)

I have compiled a list, if you don't already know, of the symbols/ sections that don't function as macro's as i've found them thus far.

%folder%
%host%
%number-files%
%number-folders%
%number%
%total-size%

{{$archive}} does not hide for disabled like %archive%
{{$upload-link}} does not hide for disabled like %upload-link%
{{$up}} does not hide for disabled like %up%
{{$login-link}} does not hide for disabled like %login-link%
{{$loggedin}} does not hide for disabled like %loggedin%

%uptime%
%timestamp%
%connections%
%speed-in%
%speed-out%
%total-in%
%total-out%
%total-downloads%
%total-uploads%
%total-hits%
%ip%

%build%
%version%

%user%

%list%

%item-url%
%item-name%

%item-size%
%item-dl-count%
%item-modified%
%sequential%
%item-comment%
%parent-folder%

{{$loggedin}} does not hide for not logged in like %login-link%

or am i doing it wrong >_> it is either {{symbol}} or {{$symbol}} {{type|symbolname}} none seem to work...

I think i get it, without %% those sections are shown as a constant, and without defined type the symbols wont show.... but whats type for say...
%list%
Title: Re: New template in the works.
Post by: Mars on December 10, 2007, 05:59:05 PM
TO TSG

download rejetto template attached

desactivate 'archivable' to root  and activate some sub-folder being archivable

and see what append  at the place of filesize

-----------------------------------------------------

pour rejetto

activer 'archivable' sur la racine implique que la même option pour les sous-dossiers est activée par défaut, il faudrait envisager les deux cas 'full archivable' and 'recursive archivable'

'full archivable'  : all subdirs are archivable by 'herited'
'recursive archivable' : only sub-folders wich are 'archivable' activated are achivable in folder.tar

tu comprends la différence??  un peu à la manière des droits sur les dossiers
Title: Re: New template in the works.
Post by: TSG on December 11, 2007, 01:52:02 AM
I took a look at the default template, it still shows the old symbols as %symbol% so i guess i'll just leave them :D
Title: Re: New template in the works.
Post by: Mars on December 11, 2007, 09:56:54 AM
It is the last one template by defaut which I used, I was only interested in the case

Quote
{{if|{{get|%item-archive%}}|{{$archive-on}}|{{$archive-off}} /if}}

[item-archive]
true

[archive-on]
<div class="quickBtn1" onmouseover="onBtn(this)" onmouseout="offBtn(this)"><a href="%item-url%~folder.tar?recursive" title="Download the content of this folder as a .tar Archive"><img src="/template/images/Download.gif" alt="DL" align="middle"></a></div>

[archive-off]
<div class="quickBtn1 disabled" onmouseover="onBtn(this)" onmouseout="offBtn(this)"><img src="/template/images/Download.gif" alt="DL" align="middle"></div>

On the other hand if the couple [mysection] and {{section|mysection}} works, he goes away differently for sections previous to the macro as [login-link] and [loggedin]

{{if not| %user% |{{section|login-link}} }}...{{if| %user% | {{section|login-link}} }}
 same result than  %login-link% ...%loggedin%

you can change %list% to {{section|list}}, it is a special usage to hfs, as for %user%

At the moment your action is limited to the former(ancient) call of section

[sym-section]   %sym-section%  ----> [mysection]   {{section|mysection}}

I think that %symbol% has to keep(guard) his structure of origin not to be confused with the macro, certain manners are in connection with data appropriate for the functioning of hfs and would require a radical modification of the code.
Title: Re: New template in the works.
Post by: TSG on December 11, 2007, 10:00:11 AM
Yes i have included something like this and many more. All i need is the ability to say, if this or this or this... somehow, then i can create my filelist with just [file] ... then, i would like the ability to find the indexOf within the header or any string, i posted in the macro one.

 All good. is substring ;)
Title: Re: New template in the works.
Post by: Unknown8063 on December 11, 2007, 04:09:33 PM
Yes i have included something like this and many more. All i need is the ability to say, if this or this or this... somehow, then i can create my filelist with just [file] ... then, i would like the ability to find the indexOf within the header or any string, i posted in the macro one.

 All good. is substring ;)

Check out Rejetto's switch macro: http://www.rejetto.com/wiki/index.php?title=HFS:_Template_macros
Title: Re: New template in the works.
Post by: TSG on December 11, 2007, 05:18:46 PM
Ye i managed to get it working with that, thanks anyway  :D

I now have all my 'files' coming out of one section with macros :) makes it very easy to edit now.

Here is what i had to do.

Code: [Select]
[file]
<tr>
<td class="iconCol">
{{switch|%item-ext%|,|jpg|{{$thumbs}}|png|{{$thumbs}}|bmp|{{$thumbs}}|<div style="background:url('/~img_file') center center no-repeat"></div>}}
</td>
<td class="fileCol%protected%" {{if|%protected%|{{$row-js-p}}|{{$row-js}}/if}}>
<span class="fileInfo">
<a href="%item-url%" {{$target}}>%item-name%</a><br/>
%comment%
<span><b>Size:</b> %item-size%</span>
<span><b>Hits:</b> %item-dl-count%</span>
<span class="age"><b>Age:</b> %item-modified%</span>
</span>
</td>
<td class="quickCol">{{switch|%item-ext%|,|jpg|{{$preview-btn}}|png|{{$preview-btn}}|bmp|{{$preview-btn}}|mp3|{{$preview-btn}}|swf|{{$preview-btn}}|divx|{{$preview-btn}}|avi|{{$preview-btn}}|<div class="disabled hide"></div>}}
<noscript><div class="disabled"></div></noscript>
<div class="quickBtn1" {{$btn-js}}><a href="%item-url%" {{$target}} title="Download this file."><img src="/template/images/Download.gif" alt="DL"></a></div>
</td>
</tr>

[thumbs]
<div style="background:url('/template/images/Default-Thumb.gif') center center no-repeat">
<noscript><div style="background:url('previews_and_thumbnails/thumb-%item-name%.jpg') center center no-repeat"></div></noscript>
<img class="hide" src="previews_and_thumbnails/thumb-%item-name%.jpg" onerror="imgError(%sequential%,this)" align="middle"/>
</div>
[preview-btn]
<div {{$btn-js}} id="s%sequential%" class="hide" {{if|{{%item-ext%=mp3}}|name="mp3File"}}><a href="javascript:void(0)"  onclick="initPreviewBox('Box-'+(%sequential%+1),'%item-ext%',this.name)" name="{{if|{{%item-ext%=mp3}}|http://%host%%encoded-folder%}}%item-url%" title="Launch preview box."><img src="/template/images/Preview.gif" alt="P" align="middle"/></a></div><span id="Box-%sequential%"></span>
[target]
{{switch|%item-ext%|,
|gif|target="_blank"
|pdf|target="_blank"
|htm|target="_blank"
|html|target="_blank"
|txt|target="_blank"
|css|target="_blank"
|jpg|target="_blank"
|png|target="_blank"
|}}
Title: Re: New template in the works.
Post by: rejetto on December 12, 2007, 01:10:13 PM
this is better {{switch|%item-ext%|,|jpg,png,bmp|{{$thumbs}}|<div ....... }}

in such case you can also use
{{if| {{match|jpg;png;bmp|%item-ext%}} | {{$thumbs}} | <div .... }}

Quote
{{$archive}} does not hide for disabled like %archive%

indeed, that's what it's meant to do.
it's not like %archive%.
%archive% is sometimes empty.
{{$archive}} is always the section.
if you want to put a condition, you can use {{if}} like the default tpl does
Title: Re: New template in the works.
Post by: TSG on December 12, 2007, 02:05:57 PM
I was wondering if i could stack up some parameters :) I will try these now.

I found the 'can archive' after some time ;)

EDIT: Cool it works, and the code is much less redundant. Am i right to say that switch is the faster method?
Title: Re: New template in the works.
Post by: rejetto on December 12, 2007, 04:55:56 PM
Ok, i am trying use macro's throughout this template. Since i've heard that it is a faster system :)

you won't get a faster template using macros in place of symbols.
the full story is rather complex, but the point is that HFS is slowed down by the making of symbols table. macros are calculated upon request, while symbols must be pre-calculated and eventually applied. symbols are calculated even if you don't use them.

some symbols will be deprecated, then discarded, over time.
Title: Re: New template in the works.
Post by: Giant Eagle on December 13, 2007, 10:29:52 AM
Are macro's faster or slower than php execution times? I mean, if you place alot of macro's in a template, would that significally reduce the speed on slower computers? (E.g. my 500mhz server).. Or is it barely noticeable

Minimizing or even remove the use of jacascript really sounds good
Title: Re: New template in the works.
Post by: Mars on December 13, 2007, 10:57:21 AM
It is as for a RUBIK'S CUBE, the speed with which you find the solution, depend on the used method.

Certain macro are faster than variables %symbol%, and conversely.
Everything depends in which context they are used.

If we have a symbol and a macro which make the same spot, they appeal to the same function in the language delphi.


The php, it is as of the javascript, but executed by the highly-rated of the server.

Quote
if you place alot of macro's in a template, would that significally reduce the speed on slower computers?

It is always the same problem, any depend of the way you order your code

Quote
if x=a then a();
if x=b then b();
if x=c then c();
....
if x=z then z();

it is faster to do

Quote
if x=a then a()
else if x=b then b()
else if x=c then c()
....
else if x=z then z();
the next

if x= b then test is closed and continue to 'the next'
Title: Re: New template in the works.
Post by: TSG on December 13, 2007, 12:08:39 PM
Can we make this one quicker... I'm not too happy with it being in 4 lines...

{{if|{{is substring|127.0.0.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|10.0.0.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|10.1.1.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|192.168|%ip%}}|{{$update-mod}}}}
Title: Re: New template in the works.
Post by: Mars on December 13, 2007, 12:31:33 PM
Quote
{{if|{{is substring|127.0.0.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|10.0.0.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|10.1.1.|%ip%}}|{{$update-mod}}}}
{{if|{{is substring|192.168|%ip%}}|{{$update-mod}}}}

replace it by

Quote
{{if |{{match address|%ip%|127.0.0.;10.0.0.;10.1.1.;192.168.}}| {{\ $update-mod /}}  /if}}
'127.0.0.;10.0.0.;10.1.1.;192.168.'   is passed to hfs as one parameter (as a mask).



new usage : '{{\ '   macro ' /}}'           at the place  of  {{macro}}  when you use  macros into a if even you get some error ( look at wiki about this) http://www.rejetto.com/wiki/index.php?title=HFS:_Template_macros#Problem
Title: Re: New template in the works.
Post by: TSG on December 13, 2007, 01:02:05 PM
Doesn't work. Copying what you have directly shows as a broken macro, and editing it to work properly, it doesn't work... I'm not trying to match whole address's just parts of address's.
Title: Re: New template in the works.
Post by: rejetto on December 13, 2007, 02:44:17 PM
I mean, if you place alot of macro's in a template, would that significally reduce the speed on slower computers? (E.g. my 500mhz server).. Or is it barely noticeable

test and let us know.  ;)

{{if |{{match address|%ip%|127.0.0.;10.0.0.;10.1.1.;192.168.}}| {{\ $update-mod /}}  /if}}

you must add {{\ ... /}}
not just \ ... /

so, it's
{{if| {{match|127.*;10.*;192.168.*|%ip%}}| {{\ {{$update-mod}} /}}  /if}}
Title: Re: New template in the works.
Post by: Foggy on December 14, 2007, 03:14:03 AM
I mean, if you place alot of macro's in a template, would that significally reduce the speed on slower computers? (E.g. my 500mhz server).. Or is it barely noticeable

test and let us know.  ;)

Out of curiosity last night I tested the ToG and TSG's new template on the same vfs consisting of 10.8k items.
The results were, ToG 54 seconds build time
and the new template 66 seconds build time

even though the tog was faster I think that the macro's are faster in general because you have to take into consideration how many macro's TSG has used for each file, and someone would be crazy to recursively list a vfs of 10.8k items let alone a have single folder of 10.8k items.
Title: Re: New template in the works.
Post by: maverick on December 14, 2007, 07:01:12 AM

Foggy,

Are you sure about the results - 54 seconds and 66 seconds?  Those build times are just less than a minute on the first test and just over a minute for the second test.  Those are very slow results to build a page.  Maybe you meant 0.540 seconds and 0.660 seconds.
Title: Re: New template in the works.
Post by: Foggy on December 14, 2007, 07:09:41 AM
Yes, I am sure. Like I said above there was about 10,800 items being listed. I also used two instances of HFS to avoid any possible caching.
Title: Re: New template in the works.
Post by: TSG on December 14, 2007, 12:52:14 PM
Local testing is a lot slower than external, i have noticed this by testing over the network, cause the browser will use 20-30% of the cpu loading the page, and hfs about 10%... and if ur listening to music thats another 5%ish :P might want to run the test again over the internet with only hfs and the browser running on the host and client pc's

Those results are correct for the test. if you do the math, its about 0.004 - 0.005 sec / row.

Even so, the results are impressive considering the amount of characters/row and like foggy stated, the amount of macro's in use in the new template. The macro system is considerably faster.
Title: Re: New template in the works.
Post by: rejetto on December 14, 2007, 04:14:53 PM
I don't think we need the macros to be faster.
It is more powerful (because some things can be done only on the server and not in javascript).
It is more compatible (because you know the compatibility problems of javascript).
It is a choice (because you can always keep using javascript if you want to).

So, even if it is 10% slower, it would be a normal price to pay.

p.s. take in account disk caching over different tries
Title: Re: New template in the works.
Post by: TSG on December 19, 2007, 05:50:41 AM
Last night I was able to remove 2 more javascript page load functions with macro, you can expect these updates in ToG and Terayon once this new one is out in the public.

What else... I've hopefully fixed the foriegn character bug with 'encodeURI' in place of 'escape' and decodeURI' in place of 'unescape'. I was going to respond to the topic but i couldn't find it, might be in the 'other language' board.

Also this template is w3c standard as xhtml, there is just 'name' errors caused by encoded characters in the name field, which i can't do anything about.

Few bugs to iron out with the preview box but it's getting there :)
Title: Re: New template in the works.
Post by: bacter on December 19, 2007, 09:17:50 AM
Consideration about speed of templates:

1. Parsing macros and replacing them by code or values will last some dozens of nanoseconds. Optimizing macros you can perhaps save some microseconds on the whole template!
2. What may be time consuming is access to disk, when not all data is already in the cache of the disk. Disk access to directories or to images or to files to be included may each be at about 10 miliseconds, this will especialy be noticed when you do things recursive or you are searching.
3. The most slow part is shuffeling out the generated page to the net. With an uploadbandwith of about 300 kbps, a 50 files page(about 25 kB) will last about 1 second, a 300 files page (100 kB) will last 3 seconds(you have to add the filesizes for images,backgrounds etc. that are not already cached on client-side).

Conclusion:
A) Using macros will create faster individual pages than java script, because decisions are taken and data manipulated on serverside, what allows to reduce the size of de code to be sent.
B) Try to hold code in recursively used sections like file,folder and link short, as this may increase the size of the generated page.
C) You can save time using external stylesheet and javascript files, as they can be cached on client side, so the generated pages are shorter.
D) Optimizing the code of macros for speed will result in about the same difference as your bodys weight after or before shaving.
Title: Re: New template in the works.
Post by: TSG on December 19, 2007, 09:31:11 AM
I'm not too concerned about speed anymore, it is all relative. But that is a detailed explanation ;)
Title: Re: New template in the works.
Post by: TSG on January 02, 2008, 02:35:16 PM
First beta is coming,
I have decided that I will release a first beta in the default blue theme to get the template out there. I have been rather busy traveling and doing other things lately. So far it is bug free from what i and my bug tester foggy can see, i just need to implement searching and it will be ready for the first beta release. Hopefully sometime tonight or tomorrow...
Title: Re: New template in the works.
Post by: TSG on January 04, 2008, 08:10:42 AM
lol 2 days later, i'm close, search is implemented, bugs are fixed, i just need to figure out how to detect values in the url with macro and i can finish it off. For those that feel helpful, what i need to do is detect for example ?search= in the url to create  no search results error page, i did it with javascript previously but i want to do it with macro. Values that i need to detect include, ?search=, ?filter=, ?files-filter=, ?folders-filter=, this will then change items on the page. I also need to grab the urlvar and show it in the default search field, that shouldn't be difficult i think there is a macro to do it already.
Title: Re: New template in the works.
Post by: Mars on January 04, 2008, 12:10:15 PM
TSG

put this in your template

{{?recursive=}}&{{?rev=}}&{{?search=}}&{{?filter=}}&{{?files-filter=}}&{{?folders-filter=}}

if you put nothing in your url you obtain 1&1&1&1&1&1

this work in URL  with all symbol you use



Title: Re: New template in the works.
Post by: rejetto on January 04, 2008, 12:45:37 PM
i'm not sure what you mean by detecting "?search="
what's wrong with "{{?search}}"  ?
Title: Re: New template in the works.
Post by: TSG on January 04, 2008, 01:02:47 PM
For an error page, I need to detect if a search returned no results so i can change 'No Files or Folders' to 'Search returned no results...' for example. I also need to grab the searched query and show it in the search field so the user knows what they searched for last.

Also i have no idea what ur talking about mars.

EDIT: dw we figured it out, now to make it work for filters.
Title: Re: New template in the works.
Post by: rejetto on January 04, 2008, 01:12:25 PM
{{if|{{?search}}{{?filter}}{{?files-filter}}{{?folders-filter}}| Search returned no results | No files or folders }}
Title: Re: New template in the works.
Post by: TSG on January 04, 2008, 01:17:35 PM
WOAH u made the same as me!

{{if|{{?search}}{{?filter}}{{?files-filter}}{{?folders-filter}}|Your search for <i>{{?search}}{{?filter}}{{?files-filter}}{{?folders-filter}}</i> returned no results.|No Files or Folders}}

only problem is showing the value for the files and folder filters cause of the extra data and i'll have to cut the string.
Title: Re: New template in the works.
Post by: rejetto on January 04, 2008, 01:24:54 PM
remember you can do
{{set|x|{{?search}}{{?filter}}{{?files-filter}}{{?folders-filter}}}}
{{if|{{^x}}|Your search for <i>{{^x}}</i> returned no results.|No Files or Folders}}

Anyway, make an example of your string problem and i will help you.
Title: Re: New template in the works.
Post by: TSG on January 04, 2008, 01:38:53 PM
my solution,

value="{{$search-data}}"

[search-data]
{{?search}}
{{cut|2|-1|
   {{?filter}}
   {{if not|{{ {{?files-filter}}=\ }}| {{?files-filter}} }}
   {{if not|{{ {{?folders-filter}}=\ }}| {{?folders-filter}} }}
}}
Title: Re: New template in the works.
Post by: rejetto on January 04, 2008, 01:48:29 PM
try {{?files-filter = \ }}
instead of {{ {{?files-filter}}=\ }}
it should work.

if you use {{set}} instead of sections, you can take things nearby.
Title: Re: New template in the works.
Post by: TSG on January 04, 2008, 01:49:53 PM
Ye, the simple search form is a long way from the [files] section so i used a section.

Ye it works rejetto, i think this template is ready for a public beta... once i read through it again lol.

http://61.68.214.92:5252/That%20Stevens%20Guy's%20Template%20Resources/Test%20Area/

test away while my dyn ip holds up lol.

RELEASED
This topic has been moved to:
http://www.rejetto.com/forum/index.php?topic=5456.0