Hi Peter!
In the first version of the template engine I had markers but now I
need more complex conditions or operations inside the template files,
like array of arrays and so on. I really like the freedom to be able
to just open a PHP tag and use a foreach() or whatever PHP
function as I please.
On 21 July 2010 06:46, Sorin Buturugeanu wrote:
> @Vincent: no, the short tags are not off.
>
> @Jim: This seamns to work fine:
>
> $template = file_get_contents(pathTemplates.$this->dir.$this->tpl);
> ob_start();
> $template = eval('?>'.$template);
> $template = ob_get_clean();
>
> Thanks!
>
> Be
@Vincent: no, the short tags are not off.
@Jim: This seamns to work fine:
$template = file_get_contents(pathTemplates.$this->dir.$this->tpl);
ob_start();
$template = eval('?>'.$template);
$template = ob_get_clean();
Thanks!
Best wishes!
Sorin
--
Sorin Buturugeanu
http://www.soin.ro
On We
On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu wrote:
> Hello Vincent and thank you for your reply :).
>
> That's true, I forgot to explain how I got to using HEREDOC, so ..
>
> Using eval(file_get_contents($file)) just outputs the result on the
> spot and I need
> to get the
Hello Vincent and thank you for your reply :).
That's true, I forgot to explain how I got to using HEREDOC, so ..
Using eval(file_get_contents($file)) just outputs the result on the
spot and I need
to get the whole output (without echoing it) and do some more things with it.
require_once() doesn
> -Original Message-
> From: Sorin Buturugeanu [mailto:m...@soin.ro]
> Sent: Tuesday, July 20, 2010 2:11 PM
> To: php-general@lists.php.net
> Subject: [PHP] eval and HEREDOC
>
> Hello,
>
> I am having trouble with a part of my templating script. I'll
> try to explain:
>
> The template
On Wed, Mar 19, 2008 at 3:22 PM, chetan rane <[EMAIL PROTECTED]> wrote:
> HI All
>
> I have the follwoing code
>
> function cleanufx($str){
> return ucase($str);
> }
>
> $value="xyz";
> $var ="ufx";
> $fn="clean$var($value);
> $val =eval("$fn;");
> echo $val;
>
> can anyo
On Mon, August 27, 2007 12:59 am, Maarten Balliauw wrote:
> Now let's repeat my question: is there any way to gracefully evaluate
> specific code, eventually catch an error and respond to that, without
> using parsekit() or launching another process to get this done?
I missed that you had an E_ERR
When re-writing this example to a form of "create_function", the same
problem occurs:
$temporaryCalculationFunction = @create_function('', $code); // E_ERROR
here
if ($temporaryCalculationFunction === FALSE) {
$returnValue = '#N/A';
} else {
$returnValue =
Maarten Balliauw wrote:
Here's the thing: I'm trying to do some dynamic code compilation within
PHP using eval(). The code I'm trying to compile raises an E_ERROR (Fatal).
Here's a simple example:
Now, I'd like to catch the error made by eval:
// ...
try {
eval($code);
} catch (Exception
Shaun
Shaun wrote:
> Is it possible to return the result of eval function to a string rather than
> outputting directly to the browser?
ob_start();
eval('$eval = "evil";');
$output = ob_get_clean();
Cheers,
David Grant
--
David Grant
http://www.grant.org.uk/
--
PHP General Mailing List (htt
[snip]
Is it possible to return the result of eval function to a string rather than
outputting directly to the browser?
Thanks for your advice
[/snip]
Yes.
You're welcome.
The first freakin' example in TFM http://www.php.net/eval is this;
--
PHP General Mailing List (http://www.php.net/)
ne
Subject: Re: [PHP] eval();
On Sun, October 30, 2005 8:51 pm, John Taylor-Johnston wrote:
> eval( " ?> $contents
>>However, if eval() is the answer, you're probably asking the wrong
>>question. You should take a hard look at your code and think of a
>>better
On Sun, October 30, 2005 8:51 pm, John Taylor-Johnston wrote:
> eval( " ?> $contents
>>However, if eval() is the answer, you're probably asking the wrong
>>question. You should take a hard look at your code and think of a
>> better
>>way to do what you need to do.
>>
>>
> Back to the drawing board
eval( " ?> $contents
However, if eval() is the answer, you're probably asking the wrong
question. You should take a hard look at your code and think of a better
way to do what you need to do.
Back to the drawing board? It is either store my html+embedded code in a
mysql record, or in an html
On Sun, 2005-10-30 at 21:24 -0500, John Taylor-Johnston wrote:
>
> >>$contents = " >>arial,helvetica; font-weight: bold;\">About the Project
> >>";
> >>echo eval($contents);
> >>?>
> >>eval() expects PHP code, not HTML with embedded PHP code. Try this
> >>(untested):
> >>
> >>eval( " ?> $contents
$contents = "arial,helvetica; font-weight: bold;\">About the Project
";
echo eval($contents);
?>
eval() expects PHP code, not HTML with embedded PHP code. Try this
(untested):
eval( " ?> $contents
Scary. But it works.
Shouldn't that error because of the unexpected ?> and example?
John
--
On Sun, 2005-10-30 at 21:16 -0500, John Taylor-Johnston wrote:
> I need to generate embedded php within in a mysql record. $contents is
> the actual contents of that record.
>
> $contents = " arial,helvetica; font-weight: bold;\">About the Project
> ";
> echo eval($contents);
> ?>
>
> I get thi
Jochem Maas wrote:
Gerard Samuel wrote:
Im trying to evaluate a string representation of the output of
var_export(),
as an array.
To make a long story short, Im using curl to fetch another php page,
that uses var_export to echo out php data structures.
The fetched data via curl, is a string. Some
Gerard Samuel wrote:
Im trying to evaluate a string representation of the output of
var_export(),
as an array.
To make a long story short, Im using curl to fetch another php page,
that uses var_export to echo out php data structures.
The fetched data via curl, is a string. Something like ->
array
Hi,
Friday, May 21, 2004, 8:26:30 AM, you wrote:
GD> How can I eval() an HTML template to make a CONSTANT be evaluated
GD> properly?
GD> Previously I have been using regular $variables in my HTML templates.
GD> Today I decided to make one of the $variables a CONSTANT only to find it
GD> would no
Thanks Michael & Marek! It worked! :)
"Michael Sims" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >> OrangeHairedBoy wrote:
> >>> I would like to use eval() to evaluate another PHP file and store
> >>> the output of that file in a string.
> >>
> >> You could use output buffering
>> OrangeHairedBoy wrote:
>>> I would like to use eval() to evaluate another PHP file and store
>>> the output of that file in a string.
>>
>> You could use output buffering to do this a bit more easily, I think:
>>
>> ob_start();
>> include('colors.php');
>> $colors = ob_get_contents();
>> ob_end_
Marek,
OK...that worked...kinda, but it doesn't pass the output to $colors. It
echos it. I need the output to be passed to $colors.
Lewis
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> OrangeHairedBoy wrote:
> > I would like to use eval() to evaluate another PHP
OrangeHairedBoy wrote:
I would like to use eval() to evaluate another PHP file and store the output
of that file in a string.
So, let's say, for example, that I have a file called colors.php which
contains this:
Colors:
Then, in another file, I have this:
$file = file_get_contents( "colors.php"
While that is an awesome idea, I don't think it will work for me.
There's two reasons why. First, colors.php is actually stored in a MySQL
server.
Second, before the PHP code inside colors.php I want to be able to replace
data inside that file. For example:
$file = str_replace( "Green" , "Orange
OrangeHairedBoy wrote:
> I would like to use eval() to evaluate another PHP file and store the
> output of that file in a string.
You could use output buffering to do this a bit more easily, I think:
ob_start();
include('colors.php');
$colors = ob_get_contents();
ob_end_clean();
--
PHP General
Hallo Tom,
am Samstag, 23. August 2003 um 17:50 hast Du Folgendes gekritzelt:
TR> Hi,
TR> Saturday, August 23, 2003, 10:01:54 PM, you wrote:
MW>> Hallo Tom,
MW>> am Samstag, 23. August 2003 um 05:14 hast Du Folgendes gekritzelt:
TR>>> This should do it:
TR>>> eval('${"content".$databasepagena
Hallo Tom,
am Samstag, 23. August 2003 um 17:50 hast Du Folgendes gekritzelt:
TR> This works for me, what error message do you get? Make sure you use
TR> single quotes in the eval otherwise the string will get substituted
TR> before eval gets a look at it.
TR> $contentarray = array(1=>'testpag
Hallo Tom,
am Samstag, 23. August 2003 um 05:14 hast Du Folgendes gekritzelt:
TR> This should do it:
TR> eval('${"content".$databasepagename}[$i]();');
I'm afraid to say it, but it does not :-(
Yesterday I was also trying to find some manual pages about eval()
which would explain me the synta
Hi,
Saturday, August 23, 2003, 8:38:32 AM, you wrote:
MW> Hi php-general,
MW> I have a question about eval();
MW> I'm having multiple pagenames I store in a database. I also have a lot
MW> of functions starting with "content" and then the name of the pages
MW> taken from the database. Ex: pagena
Decapode Azur wrote:
Is it possible to put PHP code in eval ?
Or just vars ?
$string = 'The result of ';
eval ($string);
?>
It should go like:
[code]
eval('$var = "The result of"; $a=2; $b=3; $c = $a + $b; $var .= "$a + $b is $c";');
[/code]
Just a question, what are you really trying to d
PHP-Code:
eval('?>'.$string)
Vars:
eval('$string="'.str_replace('"','\\"',$string).'";');
> Is it possible to put PHP code in eval ?
> Or just vars ?
> $string = 'The result of >';
> eval ($string);
?>>
--
Adrian
mailto:[EMAIL PROTECTED]
Hello,
This is a reply to an e-mail that you wrote on Mon, 14 Jul 2003 at 20:15,
lines prefixed by '>' were originally written by you.
> eval($data)
> returns Parse error: parse error, unexpected T_STRING in
> C:appsapache2htdocstestquery.php(23) : eval()'d code on line 1
What are the exact conte
Hello,
This is a reply to an e-mail that you wrote on Mon, 14 Jul 2003 at 20:03,
lines prefixed by '>' were originally written by you.
> How can I evaluate a var that is from a text field of a database?
> Example:
> MySQL field `name` = hi my name is $name
> In my script I have:
> $name = "Shawn"
On Mon, 2003-07-14 at 15:03, Shawn McKenzie wrote:
> How can I evaluate a var that is from a text field of a database? Example:
>
Hi Shawn--
Have you looked at eval?
http://www.php.net/eval.
Cheers,
Marco
--
php|architect -- The Magazine for PHP Professionals
NOW AVAILABLE IN PRINT! Get y
$$ is perfectly explained in the variable variables section.
Shawn McKenzie wrote:
Can you expand on this? I haven't found a ref to the $$ except for variable
variables. $$ What does it do? How is it used?
Thanks!
Shawn
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Can you expand on this? I haven't found a ref to the $$ except for variable
variables. $$ What does it do? How is it used?
Thanks!
Shawn
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Use $$ unless you need to use eval. Easier to read, faster to process.
> Also s
Use $$ unless you need to use eval. Easier to read, faster to process.
Also safer if you don't validate form data.
Jason Lehman wrote:
Is $$ the same as eval or is it different and my main question is, is it
safer to use to for processing form data?
--
The above message is encrypted with
At 12:54 10-3-03, you wrote:
what problem I want to use eval in my script but its generate this error :
Parse error: parse error, unexpected T_LNUMBER in
C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on line 4
eval ("\$all_types_list .= \"$all_types_list\";");
For tho
try
echo "\$all_types_list .= \"$all_types_list\";";
there should be a syntax error
Alawi wrote:
what problem I want to use eval in my script but its generate this error :
Parse error: parse error, unexpected T_LNUMBER in C:\Projects\phpmag\admin\functions\admin_cont.php(22) : eval()'d code on li
> ok ... what would represent?
> The output of $ofa-core->siteMapLink();?
>
> If your using XML throughout - have you looked at XSLT transformations?
It's just a symbolic name - the output is created from a few different
objects within the CMS, but it was such a commonly used set of data requests
> Currently, I'm using defined tags for replacing info from my CMS, eg:
>
> $str = ""
>
> Then I have a function that has all the objects in scope, and can
> perform the necessary replacements.
ok ... what would represent?
The output of $ofa-core->siteMapLink();?
If your using XML throughout - h
Thanks for your time, Dan.
Currently, I'm using defined tags for replacing info from my CMS, eg:
$str = ""
Then I have a function that has all the objects in scope, and can perform
the necessary replacements.
I am prototyping some stuff with smarty, but so far have yet to see how it
benefits ov
> - define a string that has a function call in it (that returns a string)
> that at the time of declaration is not in scope, eg
>
> $str = "this is the name : \$node->getName()"; // $node is _not_ defined
> currently, so we can't escape out
Ya have 2 options really (from my perspective):
1. Plac
At 14:47 03.03.2003, neko said:
[snip]
>$someVar = "testing for node - wootah, \$evalTestArr[TAG_PAGENAME]"
>
>
>then in some other function that gets passed this string
>...
>
>$evalTestArr[TAG_PAGENAME] = "hello anna marie gooberfish!";
>$str = $someVar
You da man. Thanks
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Tue, Jul 02, 2002 at 11:19:22PM -0400, Analysis & Solutions wrote:
> >
> > Oops. Forgot to escape the $:
> >
> > $var = "\$wins_$counter";
>
> Oops. Forgot my pr
On Tue, Jul 02, 2002 at 11:19:22PM -0400, Analysis & Solutions wrote:
>
> Oops. Forgot to escape the $:
>
> $var = "\$wins_$counter";
Oops. Forgot my promise to myself to always test things before posting.
I had a sinking feeling my initial posting would come back to haunt me,
but I JU
hmm... I must be doing something wrong. This is still returning 000
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Tue, Jul 02, 2002 at 10:45:27PM -0400, Analysis & Solutions wrote:
>
> >$var = "$wins_$counter";
>
> Oops. F
This doesn't seem to work. Here's my demo.
This returns 000, it should return 743
"Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Tue, Jul 02, 2002 at 10:19:59PM -0400, Greg Wineman wrote:
> >
> > He are the variables from my for
On Tue, Jul 02, 2002 at 10:45:27PM -0400, Analysis & Solutions wrote:
>$var = "$wins_$counter";
Oops. Forgot to escape the $:
$var = "\$wins_$counter";
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sq
On Tue, Jul 02, 2002 at 10:19:59PM -0400, Greg Wineman wrote:
>
> He are the variables from my form
>
> wins_1=7
> losses_1=0
> sort_1=1
> wins_2=7
> losses_2=4
> sort_2=2
> wins_3=7
> losses_3=4
> sort_3=3
>
> $counter=1;
> $wins=eval("\$wins_".$counter);
eval() is overkill and can be dangero
Sorry, please change line 2 with $x="q$i".
Bogdan
Bogdan Stancescu wrote:
> for ($i = 1; $i <= 3; $i++) {
> $x= "$q$i";
> $val=$$x;
> echo"$val\n";
> echo"\n";
> }
>
>
>
> jtjohnston wrote:
>
>> I know I'm not doing this right, but ..
>>
>> What I want to do is display the value of $q1 through
for ($i = 1; $i <= 3; $i++) {
$x= "$q$i";
$val=$$x;
echo"$val\n";
echo"\n";
}
jtjohnston wrote:
>I know I'm not doing this right, but ..
>
>What I want to do is display the value of $q1 through $q3.
>How? I can't get eval() to do it, can I?
>
>for ($i = 1; $i <= 3; $i++)
>{
>$x= eval ("\$q".$i
On Mon, 20 May 2002, jtjohnston wrote:
> I know I'm not doing this right, but ..
>
> What I want to do is display the value of $q1 through $q3.
> How? I can't get eval() to do it, can I?
>
> for ($i = 1; $i <= 3; $i++)
> {
> $x= eval ("\$q".$i);
> echo"$x\n";
> echo"\n";
> }
eval() is for runni
> So, either:
>
>
>
> Or
>
>
I found it very convenient for in-html coding to use the following
structure:
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-
> value="reg1" ?>>
You either need to remove the opening {, or put a corresponding } at the end
of the if() statement.
So, either:
Or
HTH
Jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECT
> Hi
>
> I'm trying to pre-fill a form ( the data is passed via sessions or from
> another script).
>
> i have some check boxes on the form that i would like checked if the
> variable is present.
>
> any ideas
>
Hi Paul:
I think that you can use JavaScript or VBScript to check the varia
http://www.php.net/manual/en/function.eval.php
Kirk
> -Original Message-
> From: Christopher Raymond [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 09, 2001 1:11 PM
> To: PHP List
> Subject: Re: [PHP] Eval()??? A variables contents?
>
>
> on 11/9/01
on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote:
> What you're doing doesn't make any sense. If it were to work, it would look
> like the following:
>
> ; ?>,
>
> or something similar. I think what you want to do is:
> $content = query_database($category);
> echo $content;
> ?>
>
I just asked a similar question yesterday. The answer is, conveniently
enough, eval().
One trick from the php.net page on the function is to do somehting like
this:
$content = "";
echo eval ("?>$content");
Christopher Raymond wrote:
>
> PHP Gurus:
>
> I have one for you. I'm sure there is a
On Friday 09 November 2001 11:51 am, Christopher Raymond wrote:
> Let's say I have:
>
> $content = "";
>
>
> If I use , it doesn't evaluate that content. What am
> I doing wrong here?
What you're doing doesn't make any sense. If it were to work, it would look
like the following:
; ?>,
or som
Felipe Coury wrote:
>
> Hi,
>
> I am a beginner in PHP and I am trying to do the following: I have a form in
> a page that has 3 fields: email_1, email_2 and email_3. I am trying to send
> e-mail to those people, if the fields are filled. Relevant part of code:
>
> for ($i = 1; $i <= 6; $i++)
lots of things:
1) variables in single-quoted strings aren't evaluated so you don't
need to escape the $ in $email
2) php uses . not + for concatenation.
3) try it like this:
eval('$email = $email_'.$i.';');
or
eval("\$email = \$email_$i;");
4) you can save yourself the trouble by using arrays
Hi,
> I want to evaluate the code in $php_code to *another* string...
you have to do it through output buffering:
ob_start();
eval($php_code);
$another_string=ob_get_contents();
ob_end_clean();
Rgds,
Tfr
--==< [EMAIL PROTECTED] >==< http://tfr.cafe.ee/ >==< +372-50-17621 >==--
How is this going to help me?
I want to evaluate the code in $php_code to *another* string...
- Original Message -
From: Thomas Weber <>
To: Php-General <>
Sent: Wednesday, January 24, 2001 10:14 AM
Subject: AW: [PHP] eval() to string???
> try
>
> eval("\$php_code;");
>
> -Ursprün
Yes, eval() is expensive.
On Sun, 14 Jan 2001, Adam Powell wrote:
>
> Hi, in my application I am making a lot of use of the eval() function,
> however I was wondering if this is going to cause any extra load. Does it
> do anything like load in the PHP engine again or anything? We just added it
67 matches
Mail list logo