2012-04-23 7 views
0

誰かが初心者を助けることができますか? それは、非オブジェクト上のメンバ関数set()への呼び出しが、私はこれを3日間手直ししていて、このエラーの原因を突き止めることができません。ここ非オブジェクトのメンバ関数を呼び出す

は、私はあなたがtorrent_download関数の中で、このエラーを取得していると仮定しているコード

function torrent_download($item_details, $output_type = 'show_torrent') 
    { 
    $template->set('session', $session); 
$torrent = $show->torrent_download($session->value('user_id')); 
    { 
    if ($session->value('is_seller')) 
    { 
     $show_tips = $db->count_rows('users', "WHERE user_id='" . $session->value('user_id') . "' AND notif_a=0"); 

     if ($show_tips) 
     { 
      $msg_member_tips = '<p class="errormessage">' . MSG_MEMBER_TIPS_A . '<br>' . MSG_MEMBER_TIPS_B . '</p>'; 
      $db->query("UPDATE " . DB_PREFIX . "users SET notif_a=1 WHERE user_id='" . $session->value('user_id') . "'"); 
     } 
     $template->set('msg_member_tips', $msg_member_tips); 
    } 



if (isset($_REQUEST['form_download_proceed'])) 
    { 
     $download_result = download_redirect($_REQUEST['winner_id'], $session->value('user_id')); 

     if ($download_result['redirect']) 
     { 
      header('Location: ' . $download_result['url']); 
     } 

     $template->set('msg_changes_saved', '<p align="center">' . $download_result['display'] . '</p>'); 

    } 
    } 
    } 
+0

$テンプレートは表示されません。 – ricochet1k

+0

'$ template'はどこから来ますか? – devdRew

+0

$ templateは$ template = new TemplateClass()のようにする必要があります。 (最初にクラスコードを含むファイル/スニペットを読み込む)。 – djot

答えて

1

のですか?

もしそうなら、それは$templateが定義されていないからです。おそらくあなたはそれをグローバルスクリプトで定義しましたが、関数はそれを継承しません。

global $template(および必要な外部からの変数)を関数の先頭に追加することで、この問題を防ぐことができます。

0

これは一般的に、nullの変数で何かを呼び出すことを意味します。どの行番号がエラーを返すのですか?私が言うことができるものから、

$download_result, $template, $torrent 

は、$テンプレートが定義されることはありません:

あなたがフォローを確実にするために、あなたの割り当て後にチェックを追加する必要がnullではありません。

関連する問題