You are here: Re: Writing to Heredoc from Text Area Form « PHP Programming Language « IT news, forums, messages
Re: Writing to Heredoc from Text Area Form

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация