How to display field values in columns

From JReviews Documentation
Revision as of 20:19, 24 July 2011 by Jreviews (Talk | contribs)

Jump to: navigation, search

With Multiple Select List and Checkbox custom field types, the fields can have many values. On the listing detail page those values are displayed in the same line separated by bullets.

Example:

FieldColumns1.png


Instead of the values being separated by bullets, you can display them as a list in one or more columns.

You will need to modify this theme file:

  • /com_jreviews/jreviews/views/themes/default/elements/custom_fields.thtml


Find this line:

<?php echo implode(' &#8226; ',$CustomFields->display($field['name'], $entry));?>


and replace it with this:

<ul><li><?php echo implode('</li><li>',$CustomFields->display($field['name'], $entry));?></li></ul>


If you want to get rid of bullets in front of list elements, add this to the /theme_css/theme.css file:

.fieldValue ul {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}
 
.fieldValue ul li {
	list-style: none;
}


Field values now look like this:

FieldColumns2.png


To display field values in two columns, modify css for the list elements which we added before:

.fieldValue ul li {
	list-style: none;
	display: block;
	float: left;
	width: 45%;
}


Now it looks like this:

FieldColumns3.png


To display field values in three columns, decrease the width to around 30%.

Percentages depend on the css of your Joomla template. Use Firebug to find the best value.


Displaying fields in columns in JReviews 2.3

Add this code to custom_styles.css in your theme:

ul.fieldValueList li { 
    margin-right: 5px !important; 
    float: left; 
    width: 90%; 
} 
ul.fieldValueList li:after{ 
    content:''; 
    padding:0; 
}