2014-06-15 3 views
-1

문제가 있습니다. 내 콘텐츠를 수정하려고하지만 편집을 클릭하면 오류가 발생합니다. 내가 할 오류 메시지는 다음과 같습니다경고 : Template :: error()에 대한 인수 1이 누락되었습니다.

경고 : C에서 호출 템플릿에 대한 인수 1 누락 :: 오류() : \ XAMPP \ htdocs를 \ PassieCMS \ 응용 프로그램 \ CMS \ edit.php 라인 13 및 C에 정의 : \ xampp \ htdocs \ PassieCMS \ app \ core \ models \ m_template.php on line 87

Notice : 정의되지 않은 변수 : C : \ xampp \ htdocs \ PassieCMS \ app \ core \ models \ m_template.php on 형식 여기에 라인 89

2 개 파일의 코드

편집 페이지 :

<?php 

include("../init.php"); 

if(isset($_POST['field'])) 
{ 

} 
else 
{ 
    if(isset($_GET['id']) == FALSE || isset($_GET['type']) == FALSE) 
    { 
     $FP->Template->error(); 
     exit; 
    } 

    $id = $FP->Cms->clean_block_id($_GET['id']); 
    $type = htmlentities($_GET['type'], ENT_QUOTES); 

    $content = 'Conent here'; 

    $FP->Template->setData('block_id', $id); 
    $FP->Template->setData('block_type', $type); 
    $FP->Template->setData('cms_field', $FP->Cms->generate_field($type, $content), false); 

    //load view 
    $FP->Template->load(APP_PATH . 'cms/views/v_edit.php'); 

} 

class Template에 정의 된

<?php 

/* 
    Template Class 
    Handles all templating tasks - displaying templates, alerts & errors 
*/ 

class Template 
{ 
    private $data; 
    private $alertTypes; 

    /* 
     Construtor 
    */ 
    function __construct() {} 

    /* 
     Functions 
    */ 
    function load($url) 
    { 
     include($url); 
    } 

    function redirect($url) 
    { 
     header("Location: $url"); 
    } 

    /* 
     Get/Set Data 
    */ 
    function setData($name, $value, $clean = true) 
    { 
     if(clean) 
     { 
      $this->data[$name] = htmlentities($value, ENT_QUOTES); 
     } 
     else 
     { 
      $this->data[$name] = $value; 
     } 
    } 

    function getData($name) 
    { 
     if (isset($this->data[$name])) 
     { 
      return $this->data[$name]; 
     } 
     else 
     { 
      return ''; 
     } 
    } 

    /* 
     Get/Set Alerts 
    */ 
    function setAlertTypes($types) 
    { 
     $this->alertTypes = $types; 
    } 
    function setAlert($value, $type = null) 
    { 
     if ($type == '') { $type = $this->alertTypes[0]; } 
     $_SESSION[$type][] = $value; 
    } 
    function getAlerts() 
    { 
     $data = ''; 
     foreach($this->alertTypes as $alert) 
     {   
      if (isset($_SESSION[$alert])) 
      { 
       foreach($_SESSION[$alert] as $value) 
       { 
        $data .= '<li class="'. $alert .'">' . $value . '</li>'; 
       } 
       unset($_SESSION[$alert]); 
      } 
     } 
     return $data; 
    } 

    function error($type) 
    { 
     if($type == 'unauthorized') 
     { 
      $this->load(APP_PATH . 'core/views/v_unauthorized.php');  
     } 
     else 
     { 
      $this->load(APP_PATH . 'core/views/v_error.php'); 
     } 
    } 

} 
+0

달러 (A $) 형 인수 (오류에 대한 필수입니다) 메서드를 사용하여 Template 클래스에 추가합니다. '$ FP-> Template-> error(); ' –

+0

예제가 있습니까? 그래서 당신이 무엇을 의미하는지 알 수 있습니다. – user2619538

+0

'$ FP-> Template-> error ('This is A Type'); 또는'$ FP-> Template-> error ('unauthorized'); ' –

답변

0

당신은) 당신의 오류 (에 변수에 함수를 전달하는 데 필요한 m_template 페이지 :

function error($type){ ... } 
+0

예제가 있습니까? ? 그래서 당신이 의미하는 것을 볼 수 있습니다 – user2619538

+0

Mark Baker의 코멘트가 당신을 위해 일해야한다고 생각합니다 : $ FP-> Template-> error ('unauthorized'); –

관련 문제