Displaying articles

POST run a gaming web site, and I have some friends to support me write articles or blog posts. Thing is, some people dont know every HTML, so I chose to make a very little control panel for them, kind of including the ones you use in a forum. Well I will be testing how I would display information through the database, and Concerning tried the < pre> licence plate. Although it honours range breaks as grammatical construction, it also honours that news that the information is returned as a big dirty long string, so your page stretches along with I get you ferocious horizontal scroll pub. I was wondering how I might go about having a method where your browser will present the content because it is written, with out streatching the article. I thought I’d post this around here as I dont know very well what technology I would require.

Thanks a lot in adavnce for any replies.

Just avoid using < pre>. As well as stuff like in which, as all subject matter gets dumped as-is for the display. If you would like the formatting, apply < font> as well as CSS. If you have to support special characters inside the input, write a regular expression that changes <, > along with & to their own HTML equivalents & lt;, & gt; along with & amp;.

Would there be the right way to make line breaks in the saved text showcase

Change newlines (chars #13#10 or #10) for the < br> licence plate.

Thanks a great deal for the help There has to be an entity that defines an innovative line Im unsure how to define a different line in your script (so I’ll replace it with a < br /> tag).

What language What sort of I/O operations

When you read the insight line-by-line (most probable case) then only append " < br> " to each distinct input.

Im using PHP when using the aticle stored in the MySQL database. The consumer written article is stored in the db, but next time i load it in to the PHP template You want line breaks being displayed, so I would like to replace line breaks which has a < br /> licence plate.

I never really do PHP nevertheless:

$newdata = str_replace(chr(10), " < br> ", $olddata);

Personal references:
http: //www. php. net/manual/en/function. str-replace. php
http: //www. php. net/manual/en/function. chr. php

Yay that worked! Thank you quite definitely for helping me keeping this!

no trouble. glad to guide.

Use nl2br as an alternative: http: //www. php. net/nl2br.

This entry was posted in Web Design and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *