/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Formatted Text

Hello,

I am creating a testimonials page on a clients website, from the admin page I built they can add new ones they receive, fine that works. However, when displaying it on the testimony page, and not in a <textarea> it looses its formatting. So I screwed around with <textarea> and got it to work except for I was having trouble dynamically setting the rows so you would not need to scroll to read each one.

So now I am using: nl2br($article[‘testimonial’]);

Which works great, but it still looses the indents. I know this is being nit picky, but does anyone have any better solutions?

Example:

echo:
I Love You

nl2br:
I
Love
You

What I want, as they entered it in the admin page:
I
love
you

I really appreciate it.

EDIT:
the site doesnt even indent it properly, what I want is indented on the first, double on second, triple on third

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 26.2010 — Sounds like you just need to output it in a <pre> element? (Then you don't even need the nl2br(), most likely.)
Copy linkTweet thisAlerts:
@SavourauthorAug 26.2010 — Sounds like you just need to output it in a <pre> element? (Then you don't even need the nl2br(), most likely.)[/QUOTE]

Hmmm, I forgot about <pre>, with some styling I got what I wanted. Thanks a lot!
×

Success!

Help @Savour 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.18,
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,
)...