NAmeviolated Posted October 27, 2011 Share Posted October 27, 2011 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/249878-putting-two-items-per-line/ Share on other sites More sharing options...
Psycho Posted October 27, 2011 Share Posted October 27, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/249878-putting-two-items-per-line/#findComment-1282573 Share on other sites More sharing options...
NAmeviolated Posted October 27, 2011 Author Share Posted October 27, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/249878-putting-two-items-per-line/#findComment-1282578 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.