what would be useful to me is a very simple solution that takes an html stream, a list of %parameters% and a list of substitutions. The substitions could be a callback function that does some work and returns a replacement string. The parameter delimiters should be settable/configurable.
I could imaging a Class that let's you set start and end delimeters, set a list of search parameters, and a corresponding list of substitutions or callbacks. the class would have a methods that take an html string, or directory and filename, and process that stream. I would create an object for various pages I want to process and pass the pages into the corresponding object when I wanted them parsed/substituted. Or I might just reset the object for a new html file.
Operational word - simple: here's a prototype:
Class HTML_Page
{
var /whatever vars you need/
//methods
function Set_Delimeters($start, $stop)
{
}
function Set_Keys(&$list)
{
}
function Set_Substitutions(&$list)
{
// you might need a keyword or something that identifies
a substitution as a callback. If this confuses you, ask me
}
function &Parse_HTML_File($dir,$fn)
{
return $string; // the parsed html
}
function &Parse_HTML_Str($string)
{
return $string; // the parsed HTML
}
}
if you do this, I would like to use it 🙂 in fact, I may write it 🙂
ron