簡體   English   中英

如何告訴自定義開發的magento塊使用模板?

[英]How to tell custom developed magento block to use a template?

這是控制器中的代碼

public function transactionsAction()
    {
        $ModelLayout = new Pteb_System_Model_Layout_Backend();
        $ModelLayout->LoadLayout();
        $Block = $ModelLayout->SetContentBlock( 'transactions-block', 'Pteb_System_Block_Cms' );
        $Block->setTemplate('user/transactions/results.phtml');
        $ModelLayout->ShowLayout();
    }

/ *這是要顯示在頁面上的內容,當前顯示時沒有任何模板* /

$Block->setTemplate('user/transactions/results.phtml');

/ *上面內容的模板原樣位於同一文件夾中,名稱為form.phtml 我在上面的代碼中用form.phtml替換了results.phtml ,但是它只顯示設計而不顯示內容。

基本上form.phtml包含表標題,而表格結構results.phtml包含的內容的行。* /

我如何告訴此results.phtml使用form.phtml作為模板?

您可以嘗試轉到此塊:

Pteb_System_Block_Cms

並添加以下setTemplate腳本:

public function __construct()
    {
        parent::__construct();
        $this->setTemplate('abc/abc.phtml');
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM