Generating a php file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry forgot to cc to the list - again

I'm still not sure I understand, although I'm getting there.

This might be useful.
$dynamicly_generated_script = "<?php
\$buffer = \$_SERVER['QUERY_STRING'];
\$somevar = '{$this->somevalue}';
?>";

As might this:
$dyn_gen_script = sprintf(
'<?php
$buffer = $_SERVER["QUERY_STRING"];
$somevar = \'%s\';
?>'
, $this->somevar );


On 5/11/05, Dan Rossi <php@xxxxxxxxxxxxxxxx> wrote:
>
> On 12/05/2005, at 6:03 AM, Rory Browne wrote:
>
> > You can start by clarifying. I had to read your message three times
> > before I got a vague understanding.
> >
> > What I'm hearing is that you want to put something like
> > <?php $msg = get_message(); ?> into a string? You are having
> > difficulty doing this because you are finding that your string
> > contains the value of $msg, instead of a doller sign, followed by
> > 'msg'?
> >
> > If so, then you can:
> >
> > Use Single Quotes:
> > $code = '<?php $msg = get_message(); ?>'
> >
> > or Escape your $-signs, by placing a backslash(\) in front of the
> > $-sign
> > $code = "<?php \$msg = get_message(); ?>";
> >
> >
>
> I've had a habit of this of late ! Let me clarify for you then ;)
>
> I have a php file say
>
> <?
> $query = $_SERVER['QUERY_STRING'];
> $somevar = 'somevalue';
> ?>
>
> i need to dynamically generate some values in the script and output a
> new file to download from it ie
>
> <?
> $query = $_SERVER['QUERY_STRING'];
> $somevar = $this->somevalue;
> ?>
>
> becomes
>
> <?
> $query = $_SERVER['QUERY_STRING'];
> $somevar = 'somevalue';
> ?>
>
> where $this->somevalue is from my generator class ;)
>
> However if I do
>
> $buffer = "<?
> $query = $_SERVER['QUERY_STRING'];
> $somevar = 'somevalue';
> ?>";
>
> I get all sorts of errors around $_SERVER.
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux