PDA

View Full Version : Div Layout Code


Sergio
May 19th, 2007, 01:25 PM
How can I show the code for a div layout without it actually showing like actual html? For example, I have a text area with the code for a div layout, but it doesn't appear in the text area it simply shows the myspace layout on top of my website layout.

Hopefully that made sense. Any help please?

carlee
May 19th, 2007, 01:48 PM
Did you change < to &lt; and > to &gt; ?

Sergio
May 19th, 2007, 02:19 PM
Is that the only solution? If so then I guess I'll go for it but I'm not too pleased. Thanks.

Greg-J
May 19th, 2007, 09:20 PM
That is the only solution. You can automate it though, by using the htmlentities() function.


<?php
echo htmlentities("place your html here", ENT_QUOTES);
?>



Use double quotes in your html, and use single quotes to define the string. If you also have single quotes in your html remember to /escape it.


If you need help and don't understand php, let me know and I'll try to be more descriptive.

Sergio
May 19th, 2007, 10:09 PM
Thanks but Yeah, I'm a php noob. I tried a few things with that code and I can't get it to work. So for example let's say I have this.
<textarea rows="2" name="S1" cols="20">
<div class="aboutme"></div>
</textarea>
How would I go about using that php function?

Geez I can't wait till I take php courses in September.

Greg-J
May 19th, 2007, 10:17 PM
You'de use it like this:

<?php

$code = '<textarea rows="2" name="S1" cols="20"><div class="aboutme"></div></textarea>';

echo htmlentities($code, ENT_QUOTES);
?>

Sergio
May 19th, 2007, 10:24 PM
That worked. I gotta give you props Greg, cause I've posted this in a few forums, even some dedicated to web design and they couldn't find a solution this easy. Thanks again.

Greg-J
May 20th, 2007, 02:31 AM
That worked. I gotta give you props Greg, cause I've posted this in a few forums, even some dedicated to web design and they couldn't find a solution this easy. Thanks again.
I suppose it helps that I use variations of that code to display copy/paste boxes in every script we've ever developed.

i3AyZ
May 28th, 2007, 12:28 PM
heh----------------------------------------