私はこれを達成しようとしています:
$productlist= $tpl->draw( 'products' );
後で、他のファイルにエコーしたい:
たとえば、 $tpl->draw( 'products' ) がいくつかの出力を表示している間
<div id="productlist>
include("products");
</div>
これを試して
$productlist= $tpl->draw( 'products' );
//クラスファイル
class drawing{
function draw($type) {
$str='';
if($type=='')
$type='default'
$ids=$type.'list';
$str="<div id='$ids'> include('$type') </div>";
return $str;
}
}
セッション変数を使用するか、データベースまたはフラットファイルに保存および取得することにより、データを別のスクリプトに公開できます。