php - Text formatting not working properly -
php - Text formatting not working properly -
basically have give-and-take forum takes comments users. taken textarea , set database. when set database looks this:
<p>this paragraph.</p> <p>this paragraph.</p>
when viewing individual post looks this:
this paragraph. paragraph.
when viewing main page looks this:
this paragraph.this paragraph
what i'm wondering how create formatting same both individual post , main page viewer can see multiple posts. i'm using php if helps @ all. thanks!
also, if helps here's php code i'm using echo text main page:
echo '<div style="padding:4px; style="font-size:9pt;"">'; if (strlen($blogentrytext) > 500) { $blogentrytext = substr($blogentrytext, 0, 500). '...<a href="'.website.'projects/commercialize/pipeline/blog/view.php?id='.$blogentryid.'&project='.$coaching.'&cycle='.$cycle.'">[read more]</a>'; } echo $blogentrytext; echo '</div>';
you should not allowing html tags inserted database, hacked. if want maintain formatting can utilize htmlentities() convert html equal entity, ie: "<" becomes "<"; , ">" becomes ">";, (the semicolons go next end of left them out otherwise see less , greater sign) when display page utilize html_entity_decode()
encoding http://www.php.net/manual/en/function.htmlentities.php
decoding http://www.php.net/manual/en/function.html-entity-decode.php
php html css
Comments
Post a Comment