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

default

Ini dipakai untuk menyetel nilai standar untuk sebuah variabel. Jika variabel tidak disetel atau string kosong, nilai standar diberikan untuk dicetak. Default memerlukan satu argumen.

Catatan: Dengan error_reporting(E_ALL), variabel yang tidak dideklarasikan akan selalu menghasilkan kesalahan di dalam template. Fungsi ini berguna untuk mengganti string dengan panjang null atau nol.

Posisi ParameterTipeDiperlukanDefaultDeskripsi
1stringTidakemptyIni adalah nilai standar untuk ditampilkan jika variabel kosong.

Teladan 5-9. default

assign(\'articleTitle\', \'Dealers Will Hear Car Talk at Noon.\'); $smarty->assign(\'email\', \'\'); ?>'); ?>

Di mana template adalah:

{$articleTitle|default:'no title'}
{$myTitle|default:'no title'}
{$email|default:'No email address available'}

Akan memperlihatkan:

Dealers Will Hear Car Talk at Noon.
no title
No email address available

Lihat juga penanganan variabel standar dan halaman penanganan variabel kosong.

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 11 plus 8? (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