By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

Preprocessing using PHP/XML

P: n/a
Hi,

I have an HTML help system that I am generating using the PHP CLI.
Essentially it is a single PHP file that has a few arrays at the top of the
file, before it starts spitting out HTML, like so:

$strHelpContext = "Shape";

$arrQuestionHeader = array(
"change a shape's properties",
"transform a shape",
...etc.
);

$arrQuestionBody = array(
"Some html about change a shape's properties
goes here",
"Some html about transform a shape goes here",
...etc.
);

At the moment I have five PHP files which are identical aside from the
arrays at the top, one for each help topic. Very inelegant. I have moved
the contents of all of the arrays from the five files into a nicely
structured XML file.

My question:

What would be the best way to use this XML data to generate 5 seperate HTML
files?

I am using the PHP CLI. I was thinking maybe I could just pass the CLI the
var $strHelpContext, ie in the example above this is "Shape", and have my
PHP script search through the XML file for the help section with the same
name, then populate the arrays from that. Is this the best way to do it?
If so, how do I pass the PHP CLI a variable?

TIA!
--
"Come to think of it, there are already a million monkeys on a million
typewriters, and the Usenet is NOTHING like Shakespeare!" - Blair Houghton
-=-=-=-=-=-=-=-=-=-=-=-
http://www.nrkn.com/
-=-=-=-=-=-=-=-=-=-=-=-
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.