[PHP] Heredoc inside eval?

2009-02-14 Thread Michael
I have a html template with php variables. I then run it through eval(). All that works fine. Problem is that when I add simple html attributes or javascript calls I need to use single or double quotes. And this is where eval throws an error. So I then used htmlspecialchars to mask all the

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Nitsan Bin-Nun
For instance you have: htmlbla?php echo abcd;?/bla/html The simplest way to eval() it is to use: eval(? . $string_of_html_and_php . ?php); And for what you asked, try this one: eval(\$html = hds $html; hds;); It might work. HTH, Nitsan On Sat, Feb 14, 2009 at 3:58 PM, Michael

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Michael N. Madsen
Sorry for not including a a code example of the template. html .. div{$content}/div This template I read into a variable using file_get_contents() so I don't think escaping php will work but I will have to test this. Your suggestion for the heredoc problem is simple, yet I didn't

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Nitsan Bin-Nun
I haven't figured from your sayings if my solutions worked? I haven't tested them so I thought you would check them out ;) Nitsan On Sat, Feb 14, 2009 at 6:59 PM, Michael N. Madsen m...@criion.net wrote: Sorry for not including a a code example of the template. html ..

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Michael N. Madsen
Hehe ok.. First problem was that eval() was giving error because there was double-quotes in the template. Second problem an attempt to fix problem 1 by wrapping the template in a heredoc syntax. Problem 1 I solved as described with add/strip-slashes(). Out of curiosity I will test your

Re: [PHP] heredoc

2006-12-19 Thread Jochem Maas
clr wrote: Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be ideal in that I can do all processing first and then layout with relative ease. I would say go right ahead and use

Re: [PHP] heredoc

2006-12-19 Thread Micky Hulse
I think I have come across situations where heredoc is the most useful/best solution... although, I can not remember any specific examples... I would hate to see it deprecated... I find it very useful from time to time. :) -- Wishlist: http://snipurl.com/vrs9 Switch:

[PHP] heredoc

2006-12-18 Thread clr
Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be ideal in that I can do all processing first and then layout with relative ease. I was wondering if it was acceptable to use and

Re: [PHP] heredoc

2006-12-18 Thread Chris
clr wrote: Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be ideal in that I can do all processing first and then layout with relative ease. I was wondering if it was acceptable to

Re: [PHP] heredoc

2006-12-18 Thread Paul Novitski
At 12/18/2006 10:14 PM, clr wrote: Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be ideal in that I can do all processing first and then layout with relative ease. I was wondering

Re: [PHP] heredoc

2006-12-18 Thread Casey Chu
I usually use an include rather than a heredoc. On 12/18/06, Paul Novitski [EMAIL PROTECTED] wrote: At 12/18/2006 10:14 PM, clr wrote: Please can someone advise me on heredoc and its shortcommings, I am designing a complex site and elected to use DIV's as opposed to frames. Heredoc seems to be

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-29 Thread Larry Garfield
On Saturday 28 October 2006 18:15, Robert Cummings wrote: As far as I can tell, single and double quotes are interchangeable (but unmixable) in both HTML and XHTML. When did single quotes go bad? Hmmm, I've been under the impression for quite some time that single quotes are somehow

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-28 Thread Nisse Engström
On Thu, 26 Oct 2006 13:10:17 -0400, Robert Cummings wrote: On Thu, 2006-10-26 at 11:43 +0200, clive wrote: or you could write it likes this ' echo option value='$day' $selected $day /option; much easier to read, but slightly more taxing on the server. Also slightly more taxing on

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-28 Thread Nisse Engström
On Thu, 26 Oct 2006 01:04:25 -0700, Paul Novitski wrote: It's so interesting that some details bug some people and others bug others. In an expression such as this: echo 'option value=' . $day . '' . $selected . '' . $day . '/option'; ...I count eight transitions (instances

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-28 Thread Paul Novitski
On Thu, 26 Oct 2006 01:04:25 -0700, Paul Novitski wrote: It's so interesting that some details bug some people and others bug others. In an expression such as this: echo 'option value=' . $day . '' . $selected . '' . $day . '/option'; ...I count eight transitions (instances of

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-28 Thread Robert Cummings
On Sat, 2006-10-28 at 13:27 +0200, Nisse Engström wrote: On Thu, 26 Oct 2006 13:10:17 -0400, Robert Cummings wrote: On Thu, 2006-10-26 at 11:43 +0200, clive wrote: or you could write it likes this ' echo option value='$day' $selected $day /option; much easier to read, but

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-27 Thread tedd
At 10:23 AM -0700 10/26/06, Paul Novitski wrote: At 10/26/2006 08:24 AM, tedd wrote: I think a div would work just as well -- span seems so old-world to me. :-) By default, div is a block element and span is inline, so span seemed like the natural fit for a sentence fragment. I don't think

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-27 Thread tedd
At 1:09 PM -0400 10/26/06, Robert Cummings wrote: On Thu, 2006-10-26 at 11:24 -0400, tedd wrote: At 1:04 AM -0700 10/26/06, Paul Novitski wrote: At 10/25/2006 11:24 PM, Robert Cummings wrote: I use a tag based template system, there's no PHP in my content so my content files for the most

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-27 Thread Paul Novitski
At 10:23 AM -0700 10/26/06, Paul Novitski wrote: For a robust general CMS, though, I want a completely unambiguous demarcation of replacable content. At 10/27/2006 09:01 AM, tedd wrote: If you want a completely unambiguous demarcation then use xml with a defined schema. I don't think you

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Robert Cummings
On Wed, 2006-10-25 at 22:53 -0700, Paul Novitski wrote: At 10/25/2006 04:09 PM, Stut wrote: print 'option value='.$day.''; if ($selected_day_of_month == $day) print ' selected'; print ''.$day.'/option'; On Wed, 2006-10-25 at 17:35 -0700,

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Paul Novitski
At 10/25/2006 11:24 PM, Robert Cummings wrote: Now, the thing that I dislike about heredoc for such small strings is the switching between heredoc mode and the switching back. It's ugly on the scale of switching in and out of PHP tags. It's so interesting that some details bug some people and

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread clive
Paul Novitski wrote: It's so interesting that some details bug some people and others bug others. In an expression such as this: echo 'option value=' . $day . '' . $selected . '' . $day . '/option'; or you could write it likes this ' echo option value='$day' $selected $day

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Arpad Ray
Incidentally, a nice side effect of heredoc is that some editors (like vim) recognise EOHTML, EOSQL etc and highlight the contents accordingly. Arpad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread tedd
At 1:04 AM -0700 10/26/06, Paul Novitski wrote: At 10/25/2006 11:24 PM, Robert Cummings wrote: I use a tag based template system, there's no PHP in my content so my content files for the most part just look like more HTML. This is a different topic, but also one close to my heart. Yes, I

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Stut
tedd wrote: I think a div would work just as well -- span seems so old-world to me. :-) The span element is in no way old-world. Spans and divs are two different things with different goals. A div is a block-level element, whereas spans are inline. Spans are intended for stylistic changes

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Robert Cummings
On Thu, 2006-10-26 at 01:04 -0700, Paul Novitski wrote: At 10/25/2006 11:24 PM, Robert Cummings wrote: Now, the thing that I dislike about heredoc for such small strings is the switching between heredoc mode and the switching back. It's ugly on the scale of switching in and out of PHP tags.

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Robert Cummings
On Thu, 2006-10-26 at 10:50 +0100, Arpad Ray wrote: Incidentally, a nice side effect of heredoc is that some editors (like vim) recognise EOHTML, EOSQL etc and highlight the contents accordingly. That's really cool. Never even thought to do that. I wonder if anyone has done the footwork for

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Robert Cummings
On Thu, 2006-10-26 at 11:24 -0400, tedd wrote: At 1:04 AM -0700 10/26/06, Paul Novitski wrote: At 10/25/2006 11:24 PM, Robert Cummings wrote: I use a tag based template system, there's no PHP in my content so my content files for the most part just look like more HTML. This is a different

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Robert Cummings
On Thu, 2006-10-26 at 11:43 +0200, clive wrote: Paul Novitski wrote: It's so interesting that some details bug some people and others bug others. In an expression such as this: echo 'option value=' . $day . '' . $selected . '' . $day . '/option'; or you could write it likes

Re: [PHP] heredoc usage [WAS: OPTION]

2006-10-26 Thread Paul Novitski
At 10/26/2006 08:24 AM, tedd wrote: At 1:04 AM -0700 10/26/06, Paul Novitski wrote: My comparable example (but in an HTML context) would look like: Hello span class=firstNameFIRSTNAME/span, where the engine replaces the content of the span with the value from the database based on a

[PHP] heredoc usage [WAS: OPTION]

2006-10-25 Thread Paul Novitski
At 10/25/2006 04:09 PM, Stut wrote: print 'option value='.$day.''; if ($selected_day_of_month == $day) print ' selected'; print ''.$day.'/option'; On Wed, 2006-10-25 at 17:35 -0700, Paul Novitski wrote: print hdDay

[PHP] heredoc question

2006-05-05 Thread Al
How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? I have a config file with a heredoc string declared. I'd like to keep the include config.inc at the top of my page. Down in the page, when I call the heredoc

Re: [PHP] heredoc question

2006-05-05 Thread John Nichel
Al wrote: How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? I have a config file with a heredoc string declared. I'd like to keep the include config.inc at the top of my page. Down in the page, when I call the

Re: [PHP] heredoc question

2006-05-05 Thread Paul Novitski
At 07:40 AM 5/5/2006, Al wrote: How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? Al, Escape the $'s in your heredoc expression so that the variable names remain and aren't evaluated, then eval() the whole

Re: [PHP] heredoc question

2006-05-05 Thread Robert Cummings
On Fri, 2006-05-05 at 10:40, Al wrote: How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? I have a config file with a heredoc string declared. I'd like to keep the include config.inc at the top of my page.

Re: [PHP] heredoc question

2006-05-05 Thread Dave Goodchild
Or just use str_replace On 05/05/06, John Nichel [EMAIL PROTECTED] wrote: Al wrote: How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? I have a config file with a heredoc string declared. I'd like to keep the

Re: [PHP] heredoc question

2006-05-05 Thread Al
Robert Cummings wrote: On Fri, 2006-05-05 at 10:40, Al wrote: How can I include place holders for variables in a heredoc such that after the heredoc is declared, I can assign the variables? I have a config file with a heredoc string declared. I'd like to keep the include config.inc at the

[PHP] heredoc syntax vs Double-Quotes

2006-03-15 Thread Chris Kennon
Hi, Not looking to start some pugilistic fray, but when is using heredoc advisable over Double-Quotes? Return True, Christopher Kennon Principal/Designer/Programmer -Bushidodeep http://bushidodeep.com/ __ Knowing is not enough, you must apply; willing

Re: [PHP] heredoc syntax vs Double-Quotes

2006-03-15 Thread Chris
Chris Kennon wrote: Hi, Not looking to start some pugilistic fray, but when is using heredoc advisable over Double-Quotes? Probably with really long strings or pages of data so you don't have to worry about quotes etc. Pretty much comes down to personal preference I think. -- Postgresql

Re: [PHP] heredoc syntax vs Double-Quotes

2006-03-15 Thread Paul Novitski
At 07:06 PM 3/15/2006, Chris Kennon wrote: when is using heredoc advisable over Double-Quotes? I love using heredoc primarily because it helps me separate logic from markup when generating HTML. The text in a heredoc expression is vanilla, no escape sequences needed, so there's less worry

[PHP] heredoc syntax

2004-10-20 Thread Adil
anyone know why heredoc syntax might not work with php5/apache installed. I can't get even the simplest strings in heredoc syntax to work and I've tried just cutting and pasting other peoples stuff in that syntax as well, and still no luck thx. Adil. -- PHP General Mailing List

Re: [PHP] heredoc syntax

2004-10-20 Thread Janet Valade
Adil wrote: anyone know why heredoc syntax might not work with php5/apache installed. I can't get even the simplest strings in heredoc syntax to work and I've tried just cutting and pasting other peoples stuff in that syntax as well, and still no luck thx. Adil. Heredoc syntax is pretty rigid and

Re: [PHP] heredoc syntax

2004-10-20 Thread Matthew Weier O'Phinney
* Janet Valade [EMAIL PROTECTED]: Adil wrote: anyone know why heredoc syntax might not work with php5/apache installed. I can't get even the simplest strings in heredoc syntax to work and I've tried just cutting and pasting other peoples stuff in that syntax as well, and still no luck

[PHP] Heredoc question

2003-06-06 Thread Sparky Kopetzky
Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: $message = my_message Name: ?php echo $lot-get_name(); ? Lot php echo $lot-get_id(); ? has been approved. Here is the link to

RE: [PHP] Heredoc question

2003-06-06 Thread Jennifer Goodie
Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: http://us4.php.net/types.string says that heredoc acts just like double quoted, which would mean it expands variables, so I

Re: [PHP] Heredoc question

2003-06-06 Thread Sparky Kopetzky
That's fine for that but I have several places that use if's and else's... Sparky - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 16:47 Subject: RE: [PHP] Heredoc question

RE: [PHP] Heredoc question

2003-06-06 Thread Jennifer Goodie
That's fine for that but I have several places that use if's and else's... Sparky http://us4.php.net/types.string says that heredoc acts just like double quoted, which would mean it expands variables, so I would try just Than I would suggest reading the manual page (the link I gave) to see

Re: [PHP] Heredoc question

2003-06-06 Thread Sparky Kopetzky
Subject: RE: [PHP] Heredoc question Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: http://us4.php.net/types.string says that heredoc acts just like double quoted, which

Re: [PHP] Heredoc question

2003-06-06 Thread Mark
[EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 16:47 Subject: RE: [PHP] Heredoc question Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic

Re: [PHP] Heredoc question

2003-06-05 Thread Joel Rees
That's fine for that but I have several places that use if's and else's... AFAIK, you can't do conditionals inside a here doc. But then you don't have to build your entire output string in one here doc, either. Hmm. Maybe you're trying to build templates? -- Joel Rees [EMAIL PROTECTED] --

[PHP] heredoc problem

2003-03-02 Thread janet
Can someone tell me what is wrong with the following code: html headtitleTesting/title/head body ?php $str = EOD Example of string spanning multiple lines using heredoc syntax. EOD; ? /body /html This is code straight out of the PHP manual. I get the error: Parse error: parse error,

Re: [PHP] heredoc problem

2003-03-02 Thread Ernest E Vogelsinger
At 23:02 02.03.2003, [EMAIL PROTECTED] said: [snip] Can someone tell me what is wrong with the following code: ?php $str = This is code straight out of the PHP manual. I get the error: Parse error: parse error, unexpected T_SL in testhere.php on line 5

RE: [PHP] heredoc problem

2003-03-02 Thread Martin Towell
:02 AM To: [EMAIL PROTECTED] Subject: [PHP] heredoc problem Can someone tell me what is wrong with the following code: html headtitleTesting/title/head body ?php $str = EOD Example of string spanning multiple lines using heredoc syntax. EOD; ? /body /html This is code

Re: [PHP] heredoc problem

2003-03-02 Thread janet
it. That is the problem. Good eye. Thank you, Janet -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 9:02 AM To: [EMAIL PROTECTED] Subject: [PHP] heredoc problem Can someone tell me what is wrong with the following code: headtitleTesting

Re: [PHP] heredoc problem

2003-03-02 Thread Tom Rogers
Hi, Monday, March 3, 2003, 8:02:14 AM, you wrote: jvc Can someone tell me what is wrong with the following code: jvc html jvc headtitleTesting/title/head jvc body jvc ?php jvc $str = EOD jvc Example of string jvc spanning multiple lines jvc using heredoc syntax. jvc EOD; ? jvc /body jvc