2012-10-23 2 views
0

내가 Zend 응용 프로그램을 가지고 있는데, /popular?ref=<type>에서 오는 페이지 요청을 리디렉션합니다. 여기서 유형은 openings 또는 reviews이며 요청이 색인 페이지로 리디렉션되지 않습니다. 이것은 내가 항상하는 평범한 방법 대신에 시도하는 새로운 것들입니다. 그래서 popularAction의 컨트롤러는 다음과 같이 보일 것이다 :하나의 동작으로 여러 경로에 Zend

public function popularAction() 
    { 
     $type = $this->_getParam('ref',1); 
     if($type == 'reviews'){ 

      $this->view->text = "Popular Reviews"; 

     } elseif($type == 'openings') { 
      $this->view->text = "New Openings"; 

     } else { 
      $this->_helper->redirector('index', 'index', 'default'); 
     } 

    } 

을 내가 지금 내 질문에, 내가 어떻게 사용을 부분 템플릿을 1 일반보기 템플릿 이름 popular.phtml을 할 수있다 한 그 정도 컨트롤러에 데이터를 반환되는 모든 모델 특정 참조는 데이터를 부분 템플릿에 전달한 다음 popular.phtml로 렌더링 할 수 있습니다. 감사!!

답변

0

난 당신이

0

Zend view partial가 @Arif에 동의 사용할 수 있다고 생각합니다. 젠드보기 부분을 사용해야합니다.

popularAction :

popular.phtml에서
$this->view->data = $data; // whatever be the data to be displayed on the popular.phtml 
    $this->view->type = $type; 

:

<?php if ($this->type == 'review'): 
    echo $this->partial('review.phtml',array('data' => $this->data)); 
    else: 

    echo $this->partial('opening.phtml',array('data' => $this->data)); 

    endif; ?> 

참고 : 파셜의 경로 함수 상대 TI에 지정해야합니다보기/스크립트 폴더 - 같은 "인덱스 /view.phtml "

관련 문제