View file manual-ru/language.modifier.spacify.html

File size: 3.62Kb
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>spacify</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Руководство по Smarty">
<link rel="up" href="language.modifiers.html" title="Chapter 5. Модификаторы переменных">
<link rel="prev" href="language.modifier.replace.html" title="replace">
<link rel="next" href="language.modifier.string.format.html" title="string_format">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">spacify</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.modifier.replace.html">Prev</a> </td>
<th width="60%" align="center">Chapter 5. Модификаторы переменных</th>
<td width="20%" align="right"> <a accesskey="n" href="language.modifier.string.format.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="spacify">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.modifier.spacify"></a>spacify</h2></div></div></div>
<p>
   spacify is a way to insert a space between every character of a variable.
   You can optionally pass a different character (or string) to insert.
  </p>
<div class="informaltable"><table border="1">
<colgroup>
<col align="center">
<col align="center">
<col align="center">
<col align="center">
<col>
</colgroup>
<thead><tr>
<th align="center">Позиция параметра</th>
<th align="center">Тип</th>
<th align="center">Обязателен</th>
<th align="center">По умолчанию</th>
<th>Описание</th>
</tr></thead>
<tbody><tr>
<td align="center">1</td>
<td align="center">string</td>
<td align="center">Нет</td>
<td align="center"><span class="emphasis"><em>один пробел</em></span></td>
<td>Это вставляется между каждым символом переменной.</td>
</tr></tbody>
</table></div>
<div class="example">
<a name="id2659608"></a><p class="title"><b>Example 5.16. spacify</b></p>
<div class="example-contents">
<pre class="programlisting">

&lt;?php

$smarty-&gt;assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');

?&gt;

   </pre>
<p>
    Шаблон:
   </p>
<pre class="programlisting">

{$articleTitle}
{$articleTitle|spacify}
{$articleTitle|spacify:"^^"}

   </pre>
<p>
    Результат:
   </p>
<pre class="screen">

Something Went Wrong in Jet Crash, Experts Say.
S o m e t h i n g   W .... вырезано ....  s h ,   E x p e r t s   S a y .
S^^o^^m^^e^^t^^h^^i^^n^^g^^ .... вырезано .... ^^e^^r^^t^^s^^ ^^S^^a^^y^^.

   </pre>
</div>
</div>
<br class="example-break"><p>
   См. также
   <a class="link" href="language.modifier.wordwrap.html" title="wordwrap">wordwrap</a>
   и
   <a class="link" href="language.modifier.nl2br.html" title="nl2br">nl2br</a>.
  </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.modifier.replace.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.modifiers.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.modifier.string.format.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">replace </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> string_format</td>
</tr>
</table>
</div>
</body>
</html>