2013-01-11 82 views
0

花了幾天,我的頭撞在一堵磚牆上,我需要一些幫助。基本上,我想在這裏更改代碼:用自定義php更改Joomla文章列表的佈局

<div class="itemList"> 

     <?php if(isset($this->leading) && count($this->leading)): ?> 
     <!-- Leading items --> 
     <div id="itemListLeading"> 
      <?php foreach($this->leading as $key=>$item): ?> 

      <?php 
      // Define a CSS class for the last container on each row 
      if((($key+1)%($this->params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns')) 
       $lastContainer= ' itemContainerLast'; 
      else 
       $lastContainer=''; 
      ?> 

      <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>> 
       <?php 
        // Load category_item.php by default 
        $this->item=$item; 
        echo $this->loadTemplate('item'); 
       ?> 
      </div> 
      <?php if(($key+1)%($this->params->get('num_leading_columns'))==0): ?> 
      <div class="clr"></div> 
      <?php endif; ?> 
      <?php endforeach; ?> 
      <div class="clr"></div> 
     </div> 
     <?php endif; ?> 

     <?php if(isset($this->primary) && count($this->primary)): ?> 
     <!-- Primary items --> 
     <div id="itemListPrimary"> 
      <?php foreach($this->primary as $key=>$item): ?> 

      <?php 
      // Define a CSS class for the last container on each row 
      if((($key+1)%($this->params->get('num_primary_columns'))==0) || count($this->primary)<$this->params->get('num_primary_columns')) 
       $lastContainer= ' itemContainerLast'; 
      else 
       $lastContainer=''; 
      ?> 

      <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->primary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_primary_columns'), 1).'%;"'; ?>> 
       <?php 
        // Load category_item.php by default 
        $this->item=$item; 
        echo $this->loadTemplate('item'); 
       ?> 
      </div> 
      <?php if(($key+1)%($this->params->get('num_primary_columns'))==0): ?> 
      <div class="clr"></div> 
      <?php endif; ?> 
      <?php endforeach; ?> 
      <div class="clr"></div> 
     </div> 
     <?php endif; ?> 

     <?php if(isset($this->secondary) && count($this->secondary)): ?> 
     <!-- Secondary items --> 
     <div id="itemListSecondary"> 
      <?php foreach($this->secondary as $key=>$item): ?> 

      <?php 
      // Define a CSS class for the last container on each row 
      if((($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns')) 
       $lastContainer= ' itemContainerLast'; 
      else 
       $lastContainer=''; 
      ?> 

      <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>> 
       <?php 
        // Load category_item.php by default 
        $this->item=$item; 
        echo $this->loadTemplate('item'); 
       ?> 
      </div> 
      <?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?> 
      <div class="clr"></div> 
      <?php endif; ?> 
      <?php endforeach; ?> 
      <div class="clr"></div> 
     </div> 
     <?php endif; ?> 

     <?php if(isset($this->links) && count($this->links)): ?> 
     <!-- Link items --> 
     <div id="itemListLinks"> 
      <h4><?php echo JText::_('K2_MORE'); ?></h4> 
      <?php foreach($this->links as $key=>$item): ?> 

      <?php 
      // Define a CSS class for the last container on each row 
      if((($key+1)%($this->params->get('num_links_columns'))==0) || count($this->links)<$this->params->get('num_links_columns')) 
       $lastContainer= ' itemContainerLast'; 
      else 
       $lastContainer=''; 
      ?> 

      <div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->links)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_links_columns'), 1).'%;"'; ?>> 
       <?php 
        // Load category_item_links.php by default 
        $this->item=$item; 
        echo $this->loadTemplate('item_links'); 
       ?> 
      </div> 
      <?php if(($key+1)%($this->params->get('num_links_columns'))==0): ?> 
      <div class="clr"></div> 
      <?php endif; ?> 
      <?php endforeach; ?> 
      <div class="clr"></div> 
     </div> 
     <?php endif; ?> 

    </div> 

使「龍頭」顯示一定數量的文章,然後「初級」顯示未來兩年,「次要」下一個四等。

如何做到任何幫助將是巨大的

+0

哪個文件沒有您所提供來自碼?你使用的是標準的Joomla文章還是K2? – Lodder

+0

它來自K2目錄中的category.php文件,這是K2類別佈局。真的不能解決它! – user1961395

回答