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

Name

append_by_ref() — 参照として値を追加します。

説明

void append_by_ref(string varname,
                   mixed var,
                   bool merge);

これを使用して、テンプレートに参照として値を 追加 します。 値を参照で追加すると、元の値が変更されると 追加した値も変更されます。 オブジェクト の場合は、 append_by_ref() を使用すると 追加されたオブジェクトをメモリ内でコピーすることを避けられます。 詳細は、PHP マニュアルのリファレンスの説明を参照して下さい。 任意の第3パラメータに TRUE が渡された場合は、 値は現在のテンプレート配列に追加される代わりにマージされます。

テクニカルノート

merge パラメータは配列のキーを尊重するので、 インデックスが数値である2つの配列をマージする場合、 それらはお互い上書きされるか不連続なキーの配列になるかもしれません。 これは、数値のキーを全て削除した後に再びキーに番号付けを行う、PHP の array_merge() 関数とは違っています。

Example 13.2. append_by_ref


<?php
// 名前/値 のペアを追加します
$smarty->append_by_ref('Name', $myname);
$smarty->append_by_ref('Address', $address);
?>

   

append()assign() および get_template_vars() も参照してください。

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 9? (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