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

{fetch}

{fetch} dipakai untuk mengambil file dari sistem file lokal, http, atau ftp dan menampilkan konten.

  • Jika nama file diawali dengan http://, halaman situs web akan diambil dan ditempilkan.

    Catatan: Ini tidak akan mendukung pengalihan http, pastikan untuk menyertakan garis miring terakhir pada halaman web yang anda ambil bila diperlukan.

  • Jika nama file diawali dengan ftp://, file akan di-download dari server ftp dan ditampilkan.

  • Untuk file lokal, harus memberikan baik path file sistem lengkap ataupun path relatif ke naskah php yang dijalankan.

    Catatan: Jika template $security dihidupkan dan anda sedang mengambil file dari sistem file lokal, {fetch} hanya akan membolehkan file dari dalam salah satu yang didefinisikan dalam will only allow files from within one of the defined direktori aman.

  • Jika atribut assign disetel, output fungsi {fetch} akan ditempatkan ke variabel template ini daripada ke template.

Nama AtributTypeDiperlukanDefaultDeskripsi
filestringYan/aFile, http atau situs ftp untuk diambil
assignstringTidakn/aVariabel template yang akan ditempati

Teladan 8-8. contoh {fetch}

{* sertakan beberapa javascript dalam template anda *}
{fetch file='/export/httpd/www.example.com/docs/navbar.js'}

{* sertakan beberapa teks cuaca dalam template anda dari situs web lain *}
{fetch file='http://www.myweather.com/68502/'}

{* ambil file headline berita via ftp *}
{fetch file='ftp://user:password@ftp.example.com/path/to/currentheadlines.txt'}
{* sama seperti di atas tapi dengan variabel *}
{fetch file="ftp://`$user`:`$password`@`$server`/`$path`"}

{* tempatkan konten yang diambil ke variabel template *}
{fetch file='http://www.myweather.com/68502/' assign='weather'}
{if $weather ne ''}
  <div id="weather">{$weather}</div>
{/if}

Lihat juga {capture}, {eval}, {assign} dan fetch().

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 5 plus 1? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
Cheap Hosting @HostsVault
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