Link to home
Start Free TrialLog in
Avatar of stakor
stakorFlag for United States of America

asked on

More advanced template question

There will be one HTML template, with only one placeholder. This template will be used to populate a number of HTML files. There will be a number of text files. The text files will be labeled like english-082605.txt and spanish-082505.txt. So that there will be an identifier listed first (english) and then a date 082605. There will be a number of days worth of files. Each file contains only one word. (a hex value, say "FFFFFF")

I would like to use the template to generate a html file for each identifier. (english, spanish, etc.) I would like for each file (english.html) to have it's one placeholder to be replaced with a cronological list, generated by the files. Each file haveing an entry like "FFFFFF 082605". I was thinking of using a snippet for the formating of each enty. The snippet would be all the html to make it look just right, but have a place holder for the value (FFFFFF) and the date (082605)

I can change the naming scheme if that makes it easier to accomplish. (for instance, if english-08-26-05.txt would be better, just let me know)

This question is asking a lot, so if you want more info or anything else, please let me know.

Example files listed below:

english-082605.txt:
FFFFFF

english-082505.txt:
EEEEEE

spanish-082605.txt:
FFFFFF

spanish-082505.txt:
EEEEEE

Snippet:
<b>%date%:</b> %result% <br>

Template:
<html>
<body>
%placeholder%
</body>
</html>
SOLUTION
Avatar of dbkruger
dbkruger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stakor

ASKER

There would be two output files. The english one would look like:

<html>
<body>
<b>082605:</b> FFFFFF <br>
<b>082505:</b> EEEEEE <br>
</body>
</html>

Basically the date would look like the date portion of the file name (082605 or 08-26-05) . I was envisioning the snippet being populated for each file, and then the result being appended to the template. Does this make sense?
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stakor

ASKER

Dbkruger had the first responce, and probably would have had the question answered if I had given a more complete question. I appreciate the time that you put into your responce, and I also appreciate that it is very well comented, and easy to follow.

Ozo's script did what I asked, and with my responce to Dbkruger's question is a solution to my question. Thanks for your work.

If there is a etiquette for situations like this that I am not following, please let me know. I gave the lions share to the working answer, but thought I should give points to the first responce, as it was heading in the right directino, and only was lacking because of my original question.

Thanks all.
Avatar of dbkruger
dbkruger

Thanks, that was very generous! I owe you ;-)