Keyword

Creating table for extra fields help

  • Marc
  • Marc's Avatar Topic Author
  • Offline
  • Senior Member
More
13 years 1 month ago #57854 by Marc
Can someone please look at the following code for me please, the logic is right for 2 extra fields and I have echo 'New Row' and echo 'close row' in it so I know it should all be on one row, but for some reason it still is creating 2 new rows for the 2 extra fields.
 <!-- Item extra fields -->
	  
  		
		<?php $table = '<table width="100%" border="0">'; ?>
      	<?php $counter = 0; ?>
		<?php $total1 = count($this->item->extra_fields); ?>
				
	  <?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?>
	  <!-- Item extra fields -->
	  <?php $columns = 2; ?>
      <div class="catItemExtraFields">
	  	<h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
	  	<ul>
			
			<?php foreach ($this->item->extra_fields as $key=>$extraField)  :  ?>
			
			<?php if($extraField->value) : ?>
							
							<?php $counter++; ?>
							<?php if ($counter%$columns == 1) : ?>
                            <?php echo 'New Row'; ?>
							<?php  '<tr>\n'; ?>
                            <?php endif ; ?>   
            				
                            
            <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> 
					    
        </li>
					 
					 <?php  'td width ="95px"' ; ?>
					
                    <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
                    <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
                    
					<?php '</td>' ; ?>           
                                
                    <?php if ($counter%$columns == 0): ?>
                    <?php echo 'Close Row'; ?>
					<?php '</tr>' ?>
                    <?php endif ; ?>
					                    			
           <?php endif; ?>
            
			<?php endforeach; ?>
             
			<?php $table .= '</table>'; ?>
			
            </ul>
	    <div class="clr"></div>
	  </div>
	  <?php endif; ?>
    

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum