Jump to content

Newbie: can I not escape quote characters?


OM2

Recommended Posts

Can I not escape quote characters?

Not sure if I've got the correct terminology, but I mean: when you want to print "'s in your output, you have to use \".

 

Being able to split up a page is brilliant: like having one file that is the header for all files.

 

But, the thing is, it's really annoying editing and hard to read trying to see through all the \".

The WORST thing, when editing using something like Dreamweaver: any changes have to be done manualy by looking at the code because it obviously doesn't display the code.

 

What would be brilliant is if I could have a bog standard HTML page (maybe without the HTML, Title, Body etc tags) and then be able to simply include these pages.

 

Hope that makes some sense!

 

Thanks.

 

 

OM

i've added the following into dreamweaver just to test:

 

echo <<<EOT
<div class="box-title">
My text
</div>
EOT;

 

it doesn't show up - but still ok, because i can now read and at least edit much more easily.

is there anything i can use where i can see the actual graphical representation?

 

ALSO, on php.net, they give an example:

 

echo <<<EOT
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital 'A': \x41
EOT;

 

now, they say the output should be:

 

My name is "MyName". I am printing some Foo.

Now, I am printing some Bar2.

This should print a capital 'A': A

 

when i try it: i dont get the newlines - everything is on one line.

what am i doing wrong?

i am not sure what you are doing for first one i copied that code directly and it works fine.  with regards to your second question the reason you don't get the line breaks is because html wont look at line breaks it only looks at <br> if you put the output inside a <pre> tag it will display the code as written in the source so change this

echo <<<EOT
<pre>
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital 'A': \x41
</pre>
EOT;

now the <pre> tags will make it display the line breaks.

 

Scott.

thanks for the reply scott.

i've got the latest version of dreamweaver: i was blaming dreamweaver.

hmmm not sure what the problem is!

 

for the second bit...

i think somewhere the formatting of your reply went funny and it was hard to read.

where u saying that should start with

 and end with 

??

 

i.e.

[code=php:0]echo <<<EOT


My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[

1]}.
This should print a capital 'A': \x41

EOT;

[/code]

sorry something must be going on with the forums i post html tags and instead of phrasing my bbcode tags it phrased my html tags what i was trying to say was try it like this

echo <<<EOT
<pre>
My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital 'A': \x41
</pre>
EOT;

the < pre > tag will make it look like the code boxes on this site and all your newlines will actually turn out as new lines with out having to include a < br > tag

 

Scott.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.