I need a simple php script created that will parse a folder of text files and create a .html web page form each text file in the folder.
Each text files have directory listings in them for a given city and are all in a specified format.
A typical text file looks like this:
Example typical text file name: cityname-wedding-planner.txt
and the listings are in this format:
Company Name : Company 1
Location : Cityname, State
Short Description of Services : Test descrpition #1 could contain ‘ signs, periods and commas
Phone Number : (123) 123-1234
Website Url : http://www.domain1.com
Company Name : Company 2
Location : Cityname, State
Short Description of Services : Test descrpition #2 could contain ‘ signs, periods and commas
Phone Number : (234) 567-8910
Website Url : http://www.domain2.com
Company Name : Company 3
Location : Cityname, State
Short Description of Services : Test descrpition #2 could contain ‘ signs, periods and commas
Phone Number : (345) 678-9101
Website Url : http://www.domain3.com
So I’d need the script to parse each text file and then create an html page, based on a template. The template would have tokens (or place holders) in it for each of the items of the listing ie:
%Company%
%Description%
%Location%
%Phone%
%Website%
Example output of above tokens for first listing
Company 1
Test descrpition #1 could contain ‘ signs, periods and commas
Cityname, State
(234) 567-8910
http://www.domain1.com
I’d also want the following tokens (this would be parsed from the text file name, and the state would be parsed from the first listing)
%cityname%
%industry%
%industry plural%
%state%
%text file name%
%text file name plural%
Example output of above tokens
Cityname
Wedding Planner
Wedding Planners
State
Cityname Wedding Planner
Cityname Wedding Planners