aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-builtin-functions/language-function-strip.md
blob: d40646e5f27e5b3029f601973c586610bc180fdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{strip} {#language.function.strip}
=======

Many times web designers run into the issue where white space and
carriage returns affect the output of the rendered HTML (browser
\"features\"), so you must run all your tags together in the template to
get the desired results. This usually ends up in unreadable or
unmanageable templates.

Anything within `{strip}{/strip}` tags are stripped of the extra spaces
or carriage returns at the beginnings and ends of the lines before they
are displayed. This way you can keep your templates readable, and not
worry about extra white space causing problems.

> **Note**
>
> `{strip}{/strip}` does not affect the contents of template variables,
> see the [strip modifier](#language.modifier.strip) instead.


    {* the following will be all run into one line upon output *}
    {strip}
    <table border='0'>
     <tr>
      <td>
       <a href="{$url}">
        <font color="red">This is a test</font>
       </a>
      </td>
     </tr>
    </table>
    {/strip}

      

The above example will output:


    <table border='0'><tr><td><a href="http://. snipped...</a></td></tr></table>

      

Notice that in the above example, all the lines begin and end with HTML
tags. Be aware that all the lines are run together. If you have plain
text at the beginning or end of any line, they will be run together, and
may not be desired results.

See also the [`strip`](#language.modifier.strip) modifier.