/    Sign up×
Community /Pin to ProfileBookmark

Pre-formatted Text

I have a question that I can’t seem to get answered.

I am using a CMS that I found / fixed up…

When posting new news articles, you have to format everything in HTML, putting <p> around each paragraph, etc.

Is there a way I can fix it so it doesn’t require me to do this?

I would just like to type stuff into the textbox, formatting it basically by pushing ENTER.

Anyone know what I’m talking about?

Anyone know how to do this?

Thanks,
Will

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 29.2005 — Probably easiest thing would be to use [url=http://us3.php.net/manual/en/function.nl2br.php]nl2br[/url].
[code=php]
echo "<p>".nl2br($_POST['text'])."</p>n";
[/code]
Copy linkTweet thisAlerts:
@tgrk35authorJan 29.2005 — [i]Originally posted by NogDog [/i]

[B]Probably easiest thing would be to use [url=http://us3.php.net/manual/en/function.nl2br.php]nl2br[/url].

[code=php]
echo "<p>".nl2br($_POST['text'])."</p>n";
[/code]
[/B][/QUOTE]


So would I put this where? On the actual text box or the page it outputs to :-$?

I'm confused, sorry ?.
Copy linkTweet thisAlerts:
@NogDogJan 29.2005 — The page that ouputs it. The textarea object will send the text in the POST variable with the newlines as typed in by the user. Using the nl2br() function will convert each newline character into the html <br> code instead, forcing line breaks in the output.
Copy linkTweet thisAlerts:
@tgrk35authorJan 29.2005 — Awesome ?

That worked wonderfully.

Thanks for your help,

Will
×

Success!

Help @tgrk35 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...