rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: Mars on October 25, 2007, 06:25:48 PM
-
At first I wished to count the number of links (%nb-links%) in recursive mode (missing in hfs) by means of %sequential% by using this way
[MAIN SECTION]
.
.
%files%
<script>
document.write(eval("%sequential%"-1));
</script>
[link]
<!-- %sequential% --> // masqued in web page
<TR> .....
not easy ..
I propose this modification to rejetto to include at main.pas
procedure applySequential();
const
PATTERN = '%sequential%';
NBPATERN = '%nb-sequential%'; // total of %sequential%
var
idx, p: integer;
idxS: string;
begin
idx:=0;
repeat
p:=pos(PATTERN, result);
if p = 0 then exit;
inc(idx);
idxS:=intToStr(idx);
delete(result, p, length(PATTERN)-length(idxS));
move(idxS[1], result[p], length(idxS));
until false;
idxS:=intToStr(idx); // necessary for second repeat until
repeat
p:=pos(NBPATTERN, result); // search all %nb-sequential%
if p = 0 then exit;
delete(result, p, length(NBPATTERN)-length(idxS));
move(idxS[1], result[p], length(idxS)); //replace any where in folder page
until false;
end; // applySequential
%sequential% works as before 1,2,3, .... N and after all %nb-sequential% are substitute with the value N where we find it in the web page
thanks
-
??? nobody for this topic?
-
I dont understand what exactly you are suggesting ??? :P
-
I've the same problem as Foggy. Didn't even find nothing like %nb-links% that could help to understand in the source.
I don't understand what links you want to count.
-
%sequential% can be using as a counter
every found %sequential% in a template is replaced by the value "%sequential%+1"
first "%sequential% take value "1", second take value 2",........the last take value "N"
I use it to count numbers of links in hfs web page like describe above by inserting in section [link]
<!-- %sequential% -->, hfs replace %sequential% with the adapted value and when all links are diplayed, i can use NB_links=%sequential%-1 to show the number of present links on the page of the user with document.write(NB_links);
but the problem is "i must use javascript to do this", by modifying the code source(spring) it is possible to define by hfs internally the variable %NB-SEQUENTIAL% ant it can be placed wherever in the template
all is right?
-
:P wouldnt it be simpler to ask for %total-links%
cause in terayon for example, i use 4 %sequential% things for a [file.jpg] row. Your method would show an insane amount of links on my page.
Just like %total-file% and %total-folder% you should suggest %total-links% to rejetto if thats what you really are after.
-
%total-links% is missing? YES
but you can use %sequential% to count only mp3 or only gif or only jpg (links are an example to explain) or another use
it is just a complement of %sequential% to have %NB-SEQUENTIAL%, a little thing who can help full.
When you want to use several "Total xxxx=" (%sequential% -1) "files" next must be "Total xxxx=" (%sequential% -2) to having the same value on screen ..
-
I use %sequential% for a whole different purpose.
I give elements an id using %sequential% and then refer to them by launching a script getElementById(%sequential% - 1 (or + 1, depends on the location)). This way, you dont have to give elements the file name as an id for example to make all the elements have a different id. And for that reason, i dont see the purpose of having %nb-sequential%.
In your case a simple %total-links% is enough, or even have %sequential% start at 0 so that when you display "Total links (or mp3 files or what ever file you want to count): %sequential%" it will still show the right number.
When you want to use several "Total xxxx=" (%sequential% -1) "files" next must be "Total xxxx=" (%sequential% -2) to having the same value on screen ..
then again, how many times do you present the same information to your users? seems rather unnecesary to me..
-
Ok, I understand it now. It makes sense what you are wanting to do but I think a %total-links% as GE suggested would be more better and an added bonus would be that it makes the page the users downloads that little bit smaller because you dont have all the %sequential%'s in it.
-
Thanks to Foggy which understood of what it was question in this topic :D
I've the same problem as Foggy. Didn't even find nothing like %nb-links% that could help to understand in the source.
Voilà ce que c'est que d'utiliser des templates tout fait et de ne pas en faire soi même on ne comprends pas toujours..HI
my addon code source add only possibility to use %nb-sequential% with %sequential%, you can use this possibility to another personnal use, It is not restrictive to "total-links" or another
And to be in accordance with the papers of rejetto I shall have had to propose
%number-sequential% but i find it very long
On this matter the correct syntax would be
%number-links% number of links in the current folder.
Reference to the documentation
%number% number of items in the current folder.
%number-files% number of files in the current folder.
%number-folders% number of folders in the current folder.
Each will judge that he needs or not, the only relevant question is to know if rejetto wish to include elements which do not ask for efforts of his part, and which do not break the future versions of hfs of his objectives.
Propose more of topics concerning the craftiness which you use in your templates, ca can open the other sometimes simple and powerful possibilities.
Some of you are endowed javascript there the others are him delphi there; Me, I make a little both in amateur and I try to take advantage of " language hfs " at most for my needs by sharing in the others.
Some of people will not see the necessity of such or such development, but in that case it is necessary to see coming.
I wait mainly for the answer of rejetto on this subject.
-
document.write(eval("%sequential%"-1));
document.write(%sequential%-1);
you don't need the eval.
Consider this: HFS doesn't aim to get rid of javascript. JS is a full programming language.
The next step would be someone who needs more than one counter. A neverending story.
We'll get such power server-side when we'll have CGI/PHP support. Until that time you have all the client-side power you need.
Adding a symbol for every need is not wise.
Consider this also: to count something you don't even need %sequential%. <script>my_counter++;</script>
And you got infinite counters.
-
dear rejetto
Adding a symbol for every need is not wise.
I also believe it but it is a question here of finalizing the usage of %sequential%
If the code source of the topic is correct, can he be added all the same in the next beta version?
To overload templates with the javascript?? Why when we can make simple?
Among others I resolved the problem of the %files% display by page quite there javascript without using offset and limit
-
This is not a way to proceed in the debate.
Tell me which part of my message you don't agree.