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
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
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
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
..
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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
* 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
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
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
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
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
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
[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
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]
--
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,
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
: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
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
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
55 matches
Mail list logo