Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:43:49+00:00 2026-06-12T16:43:49+00:00

Darn. Facing problem while outputting some variables in Smarty templates. Hope some one could

  • 0

Darn. Facing problem while outputting some variables in Smarty templates. Hope some one could help me out please.

I’m taking user input using textarea, which can contain anything from user (even script tags)…

I assign it to Smarty and print the variable, I write it in template as follows

{$description|nl2br}

But it shows
tag as it is, instead of having new line.

So to solve this, I used

{$description|nl2br nofilter}

It works well with
tags, but also user may input some scripts. Those scripts (javascript in tag) are getting executed…

I want something like where I can just convert new line chars to
and let only
tag execute, other tags should be printed safely.

Anyone here knows, how to make it work with Smarty well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:43:50+00:00Added an answer on June 12, 2026 at 4:43 pm

    It sounds like you’re looking for something like {$description|escape:'htmlall'|nl2br}.

    But your description makes it sound like you have $escape_html switched on, which might make it difficult to get the kind of fine-grained control you’re looking for. Try with and without nofilter, as I’m not 100% sure how you’re set up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty darn new to C# and I can't figure out how to express
As some of you know the RockScroll Visual Studio plugin is pretty darn awesome.
As most web development freelancers, I'm facing the problem of the front-end part of
I must say that so far, I've probably just been darn lucky in that
I know this is a darn simple question, but I'm very used to using
I am trying to get bash data into a variable. The problem is that
I'm in the middle of trying to copy a custom content type from one
Basically I couldn't make the darn thing to work. I am looking for runnable
I was just playing around with ckeditor and can't get the darn thing to
Basically, I need to create a method that will do its darn best to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.