Jump to content

Putting two items per line


NAmeviolated

Recommended Posts

Sorry for all the php tags in this code, but thats the way joomla is coded, so want to keep with the standard.

 

How would I stop a new line happening per item here?  I want two items per line.  I have changed the css for odd and even to be only 50%, but can't stop the new line.

 

 
<?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?>
  <!-- Item extra fields -->
  <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): ?>
		<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
			<span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
			<span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
		</li>
		<?php endif; ?>
		<?php endforeach; ?>
		</ul>
    <div class="clr"></div>
  </div>
  <?php endif; ?>

Link to comment
Share on other sites

This is not a PHP issue, it is an HTML/CSS issue.

 

Do not try and design through PHP. Create a flat-file HTML page with some sample data. Tweak the HTML and CSS code until you get the look you want. THEN create the PHP code that will generate the HTML code in the format you want.

 

Moving this to the CSS forum. I suggest you repost the HTML source code that is generated along with the CSS code for the classes used.

Link to comment
Share on other sites

Thanks.  Worked out that css is doing a lot of the damage.  Will repost as you suggested, driving me nuts.

 

CSS code

 


div.catItemExtraFields, div.genericItemExtraFields {margin:16px 0 0 0;padding:8px 0 0 0;border-top:1px dotted #ddd;}
div.catItemExtraFields h4, div.genericItemExtraFields h4 {margin:0;padding:0 0 8px 0;line-height:normal !important;}
div.catItemExtraFields ul, div.genericItemExtraFields ul {margin:0;padding:0;list-style:none;}
div.catItemExtraFields ul li, div.genericItemExtraFields ul li {display:block;}
div.catItemExtraFields span.catItemDateCreated {}
div.catItemExtraFields ul li span.catItemExtraFieldsLabel, div.genericItemExtraFields ul li span.genericItemExtraFieldsLabel {display:block;float:left;font-weight:bold;margin:0 4px 0 0;width:50%;}
div.catItemExtraFields ul li span.catItemExtraFieldsValue {}

 

HTML Code

 

<div class="catItemExtraFields">
<h4>Additional Info</h4>
<ul>
<li class="even typeDate group1">
<span class="catItemExtraFieldsLabel">Closing date</span>
<span class="catItemExtraFieldsValue">Wednesday, 26 October 2011</span>
1
</li>
<li class="odd typeSelect group1">
<span class="catItemExtraFieldsLabel">Entry Type</span>
<span class="catItemExtraFieldsValue">Upload Pic/Vid</span>
2
</li>
</ul>
<div class="clr"></div>
</div>
<div class="clr"></div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.