Get Smarty

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Check reviews of PHP Web Hosting, compatible with Smarty Templates

wordwrap

指定したカラム幅で文字列をワードラップします(デフォルトは80)。 第2パラメータには、次の行にワードラップするために使用される文字列を指定する事が出来ます (デフォルトは "\n")。 デフォルトでは、wordwrap は単語の境界でワードラップを行います。 厳密な文字数でワードラップしたい場合は第3パラメータに TRUE を渡します。 これは PHP の wordwrap() 関数と同義です。

パラメータの位置 必須 デフォルト 概要
1 integer No 80 ワードラップするカラム幅
2 string No \n ワードラップに使用される文字列
3 boolean No FALSE ワードラップを単語の境界で行うか(FALSE)、 厳密なキャラクタ数で行うか(TRUE)

Example 5.23. wordwrap


<?php

$smarty->assign('articleTitle',
                "Blind woman gets new kidney from dad she hasn't seen in years."
               );

?>

   

テンプレート


{$articleTitle}

{$articleTitle|wordwrap:30}

{$articleTitle|wordwrap:20}

{$articleTitle|wordwrap:30:"<br />\n"}

{$articleTitle|wordwrap:26:"\n":true}

   

出力


Blind woman gets new kidney from dad she hasn't seen in years.

Blind woman gets new kidney
from dad she hasn't seen in
years.

Blind woman gets new
kidney from dad she
hasn't seen in
years.

Blind woman gets new kidney<br />
from dad she hasn't seen in<br />
years.

Blind woman gets new kidn
ey from dad she hasn't se
en in years.

   

nl2br および {textformat} も参照してください。

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 13 plus 0? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
email marketing @ActiveCampaign
broadband deals @BroadbandGenie
Best UK Web Hosting @webhost.uk.net
Reliable UK and US Web Hosting @rshosting.com
Cheap US and UK Web Hosting @infrenion.com
I.T Certification Exams @pass-guaranteed.com
Certification Practice Tests @firsttrycertify.com
Certification Practice Exam Questions @ace-it-certifications.com
Broadband Speed Test @broadbandspeed.co.uk
bulk email software @americaint.com
ASP.NET hosting @aspnethosting.co.uk