1
변수를 인덱스 페이지에서 기사보기로 전달하려고합니다. 기본적으로 div의 너비는 사이드 바가 있는지 여부에 따라 변경해야합니다.joomla 3.0에서 인덱스로 변수를 넘김
의 index.php :
if ($this->countModules('position-1')&$this->countModules('position-3')){
$content_margin = 'contentCenter';
}elseif ($this->countModules('position-1')&!$this->countModules('position-3')){
$content_margin = 'contentRight';
}elseif (!$this->countModules('position-1')&$this->countModules('position-3')){
$content_margin = 'contentLeft';
}else{
$content_margin = '';
}
가 어떻게 다음 구성 요소 내에서 $의 content_margin 변수를 액세스합니까? 당신은, 당신의 구성 요소에이 변수를 전달 당신의 CSS 클래스 서로 다른 폭을 제공 할 필요가 없습니다
<div class="<?php echo $content_margin; ?>">
<jdoc:include type="component" />
</div>
:
<jdoc:include type="component" class="<?php echo $content_margin; ?>" />
볼 수 있었다 나는 결국, 그러나 그것은 경계 박스의 사용을 필요한 것을했다; '#contentContain { float : left; -moz-box-sizing : border-box; -webkit-box-sizing : border-box; 상자 크기 : 테두리 상자; * 행동 : url (/boxsizing.htc); }' – nicky