[geeks] using script to generate files from a template
Dave Kimmel
crisco_kid at shaw.ca
Sun Jun 16 11:19:52 CDT 2002
On Sun, 16 Jun 2002, William S. wrote:
> It is this particular item that I am trying to generate with the script.
> I would like to create 50+ *.php files that will be linked to on the
> menu table on a web page. Each *.php file will reference a
> different *.xsl (stylesheet) and *.xml (content/database file).
> For instance, boston.php will specify boston.xsl amd boston.xml to
> transform. boston.xsl will format a sorted table based on information
> in that city; boston.xml will be a database with that information that will
> be dynamic in content and accept records submitted from a web form.
It might be better to just pass the name of the city as a GET parameter.
Then at the start of your code, put something like:
$xml = $HTTP_GET_VARS['city'] . '.xml';
$xsl = $HTTP_GET_VARS['city'] . '.xsl';
This way, if I understand what you're doing, you'll eliminate the need for
50+ nearly identical .php files.
Of course, you will want code to prevent someone from reading any random
file off of your machine. Perhaps another XML document listing all of the
cities and their corresponding .xml and .xsl files? That way if they
provide a "city" of "/etc/passwd" or something it won't find it and will
return an error.
-- Dave Kimmel
crisco_kid at shaw.ca
More information about the geeks
mailing list