1 頁 (共 1 頁)

[問題]tpl檔嵌入tpl檔,語法要如何寫?

發表於 : 2007-10-08 00:56
kotoway
● 架設主機作業系統:win2003
● 快速架站程式:無\r
● 上網方式:學網
● 安裝的程式:
phpBB2 2.20
Apache 2.2
Php 5
MySql 5.x
● phpBB2 版本:phpBB2 2.20
● 問題:
請問,現在我有兩個tpl檔 (ex. index.tpl 和 member.tpl),
member.tpl如果要嵌入到index.tpl,語法要如何寫呢?

代碼: 選擇全部

$template->set_filenames( array('body' => 'index.tpl') );
$template->pparse('body');
謝謝指教!

發表於 : 2007-10-08 14:42
kotoway
自己找到解法囉!
假設index_body.tpl包含member_body.tpl

代碼: 選擇全部

$template->set_filenames(array(
		'body' => 'index_body.tpl',
		)
	);
$template->set_filenames(array(
			'member_body' => 'member_body.tpl')
		);
$template->assign_var_from_handle('MEMBER_BODY', 'member_body');
$template->pparse('body');