2014-06-19 2 views
0

prestashop에서 php 파일의 변수에 저장된 출력 값을 모듈 폴더 내의 템플릿 파일로 전달해야합니다. 통과 방법 똑똑한 변수 resultstring 내 템플릿 fie에 출력.prestashop에서 PHP 파일에서 값을 템플릿 파일로 전달하는 방법

PHP 코드

<?php 

$output = "welcome"; 

$smarty->assign('resultstring', $output); 

?> 

템플릿 파일 코드

{if $resultstring == 'welcome'} 
    <h6>Hai welcome</h6> 
{else} 
    <h6>not exist </h6> 
{/if} 
+1

[this] (http://doc.prestashop.com/display/PS16/Displaying+content+on+the+front-office)를 읽으셨습니까? – yenshirak

+0

Pefrom하려면이 간단한 경우 조건 prestashop 모듈을 작성해야합니까? @ user2089987 – user2089987

+0

modules 폴더에서 별도의 PHP 파일에 직접 액세스 하시겠습니까? – yenshirak

답변

0

또한 PrestaShop 버전에서 초보자,하지만 왜 어쩌면 내가 도움을 줄 수 있습니다 개입하지.

나는 당신이 당신의 PHP 파일의 내부 컨트롤러를 (당신이 당신의 모듈 폴더의 루트에 위치해야 함)을 만들 필요가 있다고 생각, 무언가 같이 : 그대로

<?php 
class displayController extends ModuleFrontController 
{ 

    $output = "welcome"; 

    $this->context->smarty->assign('resultstring', $output); 

    public function initContent() 
    { 
    parent::initContent(); 
    $this->setTemplate('template.tpl'); 
    } 


} 

당신은 템플릿 파일을 유지할 수 있습니다 .

추신 : 그것은 단지 초보자 아이디어입니다. 저를 downvoting하기 전에 저를 논평하십시오.

관련 문제