|
Posted by Matt F on 05/31/07 16:49
On Thu, 31 May 2007 17:22:49 +0200, Schraalhans Keukenmeester <Schraalhans@the.spamtrapexample.nl> wrote:
:
: I don't understand what $template is supposed to contain. Can you give an
: example of what it might look like and what you want to do with it?
:
Here's an example:
$output = <<<EOT
set route $hostarray[0] gateway $hostarray[3]
set route $hostarray[1] gateway $hostarray[3]
set route $hostarray[2] gateway $hostarray[3]
EOT;
So I would like "set route...." placed into $template. This way,
someone else can upload a new template such as:
set policy $hostarray[0] allow $hostarray[3]
set policy $hostarray[1] allow $hostarray[3]
set policy $hostarray[2] allow $hostarray[3]
: And I am missing a }. should that be following the $hostarray assignment?
: In that case you probably mean $hostarray[] = explode(",", $val);
:
foreach ($hubarray as $val) {
$val = trim($val);
$hostarray = explode(",", $val);
$output = <<<EOT
$template
EOT;
print "$output";
}
: Maybe it would be easier (not sure how your file was populated to begin
: with) to serialize the arrays, write those to a file, read them in this
: script and unserialize them again.
:
I'm open to alternatives. I basically need some way of feeding a
variables file into a template. I've been experimenting with two file
inputs instead of heredoc using text area.
Thanks again!
Matt
Navigation:
[Reply to this message]
|