Text on web page

S

salonowiec

I'd like to make something that seems absolutely simple: to put the
fragment of html code so that it will be seen for users and not
interpreted. For example:

$template_thumb_view_title_row = <<<EOT

<table width="100%" cellpadding="0"
cellspacing="0">
<tr>
<td width="100%"
class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif"
width="1" alt="" /></td>
</tr>
</table>

EOT;

But computer makes the interpretation and part of the text disappears!
Thank you
 
N

Neredbojias

I'd like to make something that seems absolutely simple: to put the
fragment of html code so that it will be seen for users and not
interpreted. For example:

$template_thumb_view_title_row = <<<EOT

<table width="100%" cellpadding="0"
cellspacing="0">
<tr>
<td width="100%"
class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif"
width="1" alt="" /></td>
</tr>
</table>

EOT;

But computer makes the interpretation and part of the text disappears!

I dunno what <<<EOT is but for the html you must use html entities for
certain characters like "<" and ">" (-which in this case are &lt; and &gt;
respectively.)
 
M

mynameisnobodyodyssea

I'd like to make something that seems absolutely simple: to put the
fragment of html code so that it will be seen for users and not
interpreted. For example:

$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="0"
cellspacing="0">
                        <tr>
                                <td width="100%"
class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif"
width="1" alt="" /></td>
                        </tr>
                        </table>

EOT;

But computer makes the interpretation and part of the text disappears!
Thank you

This looks like a PHP heredoc string
that must be declared and then
printed to the browser (probably using echo)
within the <?php ... ?> tags,
for example

<?php
$template_thumb_view_title_row = <<<EOT
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"
class="statlink"><h2>{ALBUM_NAME}</h2></td>
<td><img src="images/spacer.gif"
width="1" alt="" /></td>
</tr>
</table>
EOT;

// ..... maybe something else here before printing ... and print

echo $template_thumb_view_title_row;
?>
 
S

salonowiec

U¿ytkownik "Neredbojias said:
I dunno what <<<EOT is but for the html you must use html entities for
certain characters like "<" and ">" (-which in this case are &lt; and &gt;
respectively.)

Entities, of course!... Many thanks.
 
D

dorayme

Neredbojias said:
I dunno what <<<EOT is but for the html you must use html entities for
certain characters like "<" and ">" (-which in this case are &lt; and &gt;
respectively.)

And look up the "code" element, you might find it useful.
 
N

Neredbojias

And look up the "code" element, you might find it useful.

Okay. I've run across Heredoc references before but know zilch about it.
Perhaps it's something like "pre"...
 
M

mynameisnobodyodyssea

Okay.  I've run across Heredoc references before but know zilch about it..  
Perhaps it's something like "pre"...

herodoc syntax is for declaring strings in PHP (or Perl)
for PHP see
http://www.php.net/manual/en/language.types.string.php#language.types.string..syntax.heredoc

If the question was about printing as HTML
to the browser an example with the text
of a PHP script, then escaping the angle brackets as
&lt; or &gt; as you suggested would of course help with printing the
whole text.

I thought the question was about a different thing,
about declaring a string variable in
PHP and printing it to the browser later,
but I do not know the context in which that code is used :(
 
N

Neredbojias

herodoc syntax is for declaring strings in PHP (or Perl)
for PHP see
http://www.php.net/manual/en/language.types.string.php#language.types.s
tring.syntax.heredoc

If the question was about printing as HTML
to the browser an example with the text
of a PHP script, then escaping the angle brackets as
&lt; or &gt; as you suggested would of course help with printing the
whole text.

I thought the question was about a different thing,
about declaring a string variable in
PHP and printing it to the browser later,
but I do not know the context in which that code is used :(

Okay, I grok it. Good explanation. I believe when I ran across it I
decided I didn't want to do anything like that and so expunged it from my
mind, but you (and rf) set me straight.
 
M

mrcakey

Neredbojias said:
'Welcome. Er, did it work? Subsequent posters seem to be expressing
doubts.

Sorry, didn't mean to be rude. In all my experience with PHP I've never had
an issue outputting < and > as is so I was surprised that 'fixed' OP's
issue - looked to me like they'd not enclosed code in PHP tags or maybe
tried to run it on a non-PHP server.

+mrcakey
 
N

Neredbojias

Sorry, didn't mean to be rude. In all my experience with PHP I've
never had an issue outputting < and > as is so I was surprised that
'fixed' OP's issue - looked to me like they'd not enclosed code in PHP
tags or maybe tried to run it on a non-PHP server.

I didn't think you were rude, just expressing doubts. If you _want_ to be
rude, use phrases like "your code is broken", "stop wanting that", and some
of the other gem cliches that float around here.

I viewed the OP's problem from an html perspective, hence the disclaimer
about <<<EOT.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top