2013-12-23 35 views
0

我有我的Joomla 3 index.php文件下面的語句,我試圖找出:的Joomla 3 PHP的if else語句

<?php if ($this->countModules('right')) : ?> 
<?php if(JRequest::getVar('view') == 'article'): ?> 
    <div class="col-md-<?php echo $right; ?>"> 
    <section class="sidebar right-sidebar"> 
     <jdoc:include type="modules" name="right" style="standard" /> 
    </section> 
    </div> 
<?php endif; ?> 
<?php endif; ?> 

我需要這樣下發生改變上面的語句:

方案1

如果沒有在正確的位置,刪除所有div完全

方案2

如果模塊正確的位置顯示模塊中,但只有在文章頁 - 博客分類頁面

PHP的新手 - 我會怎麼做這個說法?

+0

第一狀況能夠使用js代碼或jQuery的lib下,我不認爲它可能通過PHP – dreamweiver

+0

這真是一個Joomal人來完成...方案1是完全有可能的使用Joomla,但我需要也包含場景2 - 兩者都可以單獨使用,但我需要將它們作爲一個聲明。 – user991830

回答

1

你有沒有嘗試這個辦法:

<?php if(JRequest::getVar('view') == 'article' || $this->countModules('right')): ?> 
    <div class="col-md-<?php echo $right; ?>"> 
     <section class="sidebar right-sidebar"> 
      <jdoc:include type="modules" name="right" style="standard" /> 
     </section> 
    </div> 
<?php endif; ?>