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 sug

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 wrote: > Sorry for not including a a code example of the template. > > > .. >{$content} > > This template

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Michael N. Madsen
Sorry for not including a a code example of the template. .. {$content} 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 think of it :D

Re: [PHP] Heredoc inside eval?

2009-02-14 Thread Nitsan Bin-Nun
For instance you have: The simplest way to eval() it is to use: eval("?>" . $string_of_html_and_php . " On Sat, Feb 14, 2009 at 3:58 PM, Michael wrote: > 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 attrib

[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 non-

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: Switch:

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-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

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 if

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 u

[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 maint

Re: [PHP] heredoc usage [WAS:

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 s

Re: [PHP] heredoc usage [WAS:

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 " $day "; > >> > >> much easier to read, but slightly more taxing on th

Re: [PHP] heredoc usage [WAS:

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 '' . $day > . ''; > > ...I count eight transitions (instances of switching between PHP > syntax and output

Re: [PHP] heredoc usage [WAS:

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 '' . $day > . ''; > > ...I count eight transitions (instances of switching between PHP > syntax and outpu

Re: [PHP] heredoc usage [WAS:

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 " $day "; >> >> much easier to read, but slightly more taxing on the server. > > Also slightly more taxing on standards since single quot

Re: [PHP] heredoc usage [WAS:

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 c

Re: [PHP] heredoc usage [WAS:

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 mos

Re: [PHP] heredoc usage [WAS:

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 would work just as well -- 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 there'

Re: [PHP] heredoc usage [WAS:

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 FIRSTNAME, where the engine replaces the content of the span with the value from the database based on a match of 'span.firstName'

Re: [PHP] heredoc usage [WAS:

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 '' . $day . > > ''; > or you could write it likes this ' > echo " $day "; > > much

Re: [PHP] heredoc usage [WAS:

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

Re: [PHP] heredoc usage [WAS:

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 << accordingly. That's really cool. Never even thought to do that. I wonder if anyone has done the footwork for joe to save me some time *hehe*. Cheers, R

Re: [PHP] heredoc usage [WAS:

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 ta

Re: [PHP] heredoc usage [WAS:

2006-10-26 Thread Stut
tedd wrote: I think a would work just as well -- 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 that spa

Re: [PHP] heredoc usage [WAS:

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 too

Re: [PHP] heredoc usage [WAS:

2006-10-26 Thread Arpad Ray
Incidentally, a nice side effect of heredoc is that some editors (like vim) recognise <

Re: [PHP] heredoc usage [WAS:

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 '' . $day . ''; or you could write it likes this ' echo " $day "; much easier to read, but slightly more taxing on the server. -- Regards, Clive

Re: [PHP] heredoc usage [WAS:

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 o

Re: [PHP] heredoc usage [WAS:

2006-10-25 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 ' > > > if ($selected_day_of_month == $day) > > > > print ' selected'; > > > > print '>'.$day.''; > > On Wed, 2006-10-25 at 17:35 -0700, Paul Novitski

[PHP] heredoc usage [WAS:

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

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

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

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 pag

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 expres

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 h

[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 varia

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 a

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

[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 i

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

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

[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 (http://www.php.

Re: [PHP] Heredoc question

2003-06-06 Thread Mark
net > > - 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 ques

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)

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]>

RE: [PHP] Heredoc question

2003-06-06 Thread Jennifer Goodie
> Can one use 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 would

[PHP] Heredoc question

2003-06-06 Thread Sparky Kopetzky
Can one use 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 = < Lot get_id(); ?> has been approved. Here is the link to the lot: my_message; Robin E. Kopetzky Black Mes

Re: [PHP] Heredoc question

2003-06-06 Thread Sparky Kopetzky
s/Internet Services www.blackmesa-isp.net - 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 q

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]> --

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> jvc> Testing jvc> jvc> $str = << Example of string jvc> spanning multiple lines jvc> using heredoc syntax. jvc> EOD; ?>> jvc> jvc> jvc> This is code straight out of the

Re: [PHP] heredoc problem

2003-03-02 Thread janet
. > That's 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 >>

RE: [PHP] heredoc problem

2003-03-02 Thread Martin Towell
March 03, 2003 9:02 AM > To: [EMAIL PROTECTED] > Subject: [PHP] heredoc problem > > > Can someone tell me what is wrong with the following code: > > > Testing > > $str = << Example of string > spanning multiple lines > using heredoc syntax. >

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: > >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 > >I looked

[PHP] heredoc problem

2003-03-02 Thread janet
Can someone tell me what is wrong with the following code: Testing 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 I looked up T_SL and it is a token representing << so that means it just doesn't get the <<<.