2013-07-10 4 views
0

예를 들어, 매개 변수 1, 모듈 반환 1, 2와 함께 호출 할 때 2 e.t.c를 호출 할 때 모듈이 작성되면 커스텀 모듈을 작성합니다.Joomla 모듈에 매개 변수 보내기

하지만 모든 설명서, 페이지에서 매개 변수로 매개 변수를 보내는 방법을 찾을 수 없습니다. 그것의 지금 모듈 호출 방법 :

jimport('joomla.application.module.helper');        
$modules = JModuleHelper::getModules('NAME_OF_CUSTOM_POSITION'); 
$count_array = count($modules); 
if ($count_array >0) 
    { 
    $attribs['style'] = 'xhtml'; 
    echo JModuleHelper::renderModule($modules[0], $attribs); 
    }        
?> 

하지만 PARAMS도 어떻게 내 모듈을받을하는 방법을 전송하는 방법을 모르겠어요.

답변

1

아래 코드를 사용자 지정 구성 요소 중 하나에서 사용했습니다. 그리고 저에게 도움이되었습니다.

$document = JFactory::getDocument(); 
$renderer = $document->loadRenderer('module');   
$params = array('style'=>'xhtml');   
$contents = ''; 
foreach (JModuleHelper::getModules('NAME_OF_CUSTOM_POSITION') as $mod) { 
    $registry = new JRegistry(); 
    $registry->loadString($mod->params); 
    $registry->set('paramname','paramvalue'); 
    $mod->params = (string)$registry; 
    $contents .= $renderer->render($mod, $params); 
} 
echo $contents; 
+0

이 모듈을 어떻게 얻을 수 있습니까? 아니면 그냥 mod_module.php의 params에 $ params를 사용해야합니까? – JohnDow

+0

@ VladislavIl'ushin : 예, $ params 변수를 사용하여 얻을 수 있습니다. – Irfan