Hi to all!

First of all, thanks for the ICS components, a really nice
collection of components to use.

I have a problem when try to use the TUrlHandler.Answerpage
method. In fact, I have problems when triying to use "dinamyc"
tags".

I try to explain. Supose I write something like this:

---

AnswerPage( '', '', '/template.html', nil, [ 'Name', 'Jhon Doe' ] );

---

Everything is OK, the template.html file is served as expected,
with the "Name" tag appropiately replaced with "Jhon Doe"
value.

Now supose I write something like this:

--

var
  openArray : array of TVarRec;

begin
  SetLength( openArray, 2 );

  openArray[ 0 ].VType := vtAnsiString;
  openArray[ 0 ].VAnsiString := PChar( 'Name' );

  openArray[ 1 ].VType := vtAnsiString;
  openArray[ 1 ].VAnsiString := PChar( 'Jhon Doe' );

  AnswerPage( '', '', '/template.html', nil, openArray );

--

Again everything is OK and work fine. But... supose now
I dont know what tags need to be added to the template.

So, I tried something like this:

---

var
  tags : array of TVarRec;

begin

{...}

if tagsCount <> -1 then
begin
  SetLength( tags, tagsCount );
  for i := 0 to tagsCount - 1 do
  begin
    s := GetTheValueOfS( theTags, i ); // Just for example

    tags[ i ].VType := vtAnsiString;
    tags[ i ].VAnsiString := PChar( s );
  end;
end;

AnswerPage( '', '', '/template.html', nil, tags );

---

So this not work at all. My idea (and need) is to fill a
"array of TVarRec", and then pass to the "AnswerPage"
method, but, did not work.

The Array is OK, that is, I can iterate with their values
and everything is OK, but, debugging the project I can
see that finally something is wrong, the values (almost
someone) are lost.

I dream with a solution. Or for a possible "AnswerPage"
overloading method that admit a "TStrings" for the Tags,
instead of a "array of const".

This last work like a charm, except then need to fill the
array using a "TPVarRec" dinamically, as I explain above.

So anyone can help me? Any idea, suggestion or comment?

If anything is not clear (sorry my poor english) please, tell
me and I try to explain my problem again.

Thanks very much in advance.

Cheers!

-- 

David Esperalta*
Freelance Software Developer
**Email:* davidespera...@gmail.com
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to