WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How to

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Parsing variables to a Html-template

Keywords: 	   binarytag

Question:

I tried the following: In order to avoid mixing program-source and Webdeign I created a html file with strings like %var1% %var2% and so on.

In Webbatch I declared values for var1, var2 and so on. then I did read the html-file line by line and with Webout passed it line by line to the Brwoser. The result was, that the browser returned "%var1%", "%var2%" and so on instead of "value1", "value2" and so on.

When I copy the same lines out of the html-file and paste it to the source code, the variables are substituted correctly with their respective values.

Anything wrong?

Answer:

% signes are only special in WinBatch source code, not in the data it processes.

Maybe add a few StrReplace operations between reading the line and writing the data.

If the files are BIG, I can recommend faster ways of doing it.

Question:

Aha, I thought
	>> templateline = FileRead(templatefile)
	>> WebOut (templateline,1)
Where templateline=="Text %var1% Text %var2% Text"

should produce the same output as

	>> Webout ("Text %var1% Text %var2% Text",1)
Yes, the template ist too big to apply 6 different StrReplace on every line.

What could be done instead of it?

Answer (cont'd):

Well, download the HTML Dialog Extender.

You don't have to use it at all, but there is a good tutorial in there about the use of the BinaryTag functions.

With some small changes to the HTML file and the use of the various BinaryTag functions, you can easily customize vast quantities of html.

Mostly I want you to see the Html Extender help file for the tutorial on using the BinaryTag functions. You won't really use the extender in your script, but should be able to learn about how to use the BinaryTag functions to edit your html files.


Article ID:   W14125
Filename:   Parsing Variables to a Html-template.txt
File Created: 1999:06:09:14:33:38
Last Updated: 1999:06:09:14:33:38