PHP Classes

File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-strip.md

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-strip.md   Download  
File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-strip.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change:
Date: 2 months ago
Size: 870 bytes
 

Contents

Class file image Download

strip

This replaces all spaces, newlines and tabs with a single space, or with the supplied string.

Basic usage

{$myVar|strip}

> Note > > If you want to strip blocks of template text, use the built-in > {strip} function.

Examples

<?php
$smarty->assign('articleTitle', "Grandmother of\neight makes\t    hole in one.");
$smarty->display('index.tpl');

Where template is:

{$articleTitle}
{$articleTitle|strip}
{$articleTitle|strip:'&nbsp;'}

Will output:

Grandmother of
eight makes        hole in one.
Grandmother of eight makes hole in one.
Grandmother&nbsp;of&nbsp;eight&nbsp;makes&nbsp;hole&nbsp;in&nbsp;one.

See also {strip} and truncate.