Re: Writing to Heredoc from Text Area Form



On Thu, 31 May 2007 17:22:49 +0200, Schraalhans Keukenmeester <Schraalhans@xxxxxxxxxxxxxxxxxxxxxx> 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
.



Relevant Pages

  • Re: trouble creating array of objects
    ... > about dynamically multidimensinoal arrays is described. ... it's an excellent learning excercise. ... This is called the C++ standard template library and it is an addition to ... >> Another reason might be the overheads incurred. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Help needed for a sorting code in the literature
    ... It doesn't need to deal with checking memory. ... >>template version where the type being sorted is a template parameter. ... >>I have tested the speed of the heapsort code above on arrays of up to ...
    (sci.crypt)
  • Help: How many explicit specializations required?
    ... I need to have a template for T ... Passing arrays of T will be resolved into case 2. ... void func ... int main ...
    (comp.lang.cpp)
  • Storing arrays within a template
    ... Create a single template to contain some simple boilerplate and code that ... will build a document based on user selection of one or more command buttons ... text stored within the template. ... to edit or add to these arrays of text. ...
    (microsoft.public.word.vba.general)
  • Re: Fortran vs. C++ : Which is best to choose now i
    ... programming through the template facility and associated standard ... All of the libraries mentioned below are ... You can't take a code that uses Blitz arrays ... LAPACK effectively requires compiling the entire LAPACK library ...
    (comp.lang.fortran)