- Posts: 103
- Thank you received: 5
display custom field output in unordered list
7 years 9 months ago #302014
by n00bster
display custom field output in unordered list was created by n00bster
-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2
i have setup a multiselect field where i defined some default values. i display the output right now with this code:
but what i need is the values presented in a html list like the following sample:
i did a lot of testing but without a working result right now, this is what i have but as i sad, it does not working:
has anyone here a working code to show the values in a list and could give me some inputs. that would be very nice.
i also noticed mean while i'm working on the list output, that the normal output, without lists, between the values are no spaces/blanks:
should't as default a blank between??
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.2
i have setup a multiselect field where i defined some default values. i display the output right now with this code:
Code:
<?php if(isset($this->row->sportuse) && !empty($this->row->sportuse)) {echo $this->row->sportuse; } ?>
Code:
[ul]
[li]value 01[/li]
[li]value 02[/li]
[li]...[/li]
[/ul]
Code:
<?php
if(isset($this->row->sportuse) && !empty($this->row->sportuse)) {
echo '<ul>';
echo '<li>' . implode( '</li><li>', $this->row->sportuse) . '</li>';
echo '</ul>';
}
?>
i also noticed mean while i'm working on the list output, that the normal output, without lists, between the values are no spaces/blanks:
Code:
value01,value01,value03,...
Code:
value01, value02, value03, ...
Please Log in or Create an account to join the conversation.
7 years 9 months ago #302015
by nicolas
Replied by nicolas on topic display custom field output in unordered list
Hi,
You want to change the line:
to:
It's normal there is no space after the commas since you're displaying the raw data from the database. If however you let HikaShop display the custom field value itself, it will have a space after the commas as the custom field system will process the data:
monosnap.com/file/cluOz8BSQLTknlKaxvaspyoqfdHZOP
You want to change the line:
Code:
echo '<li>' . implode( '</li><li>', $this->row->sportuse) . '</li>';
Code:
foreach(explode(',',$this->row->sportuse) as $s){ echo '<li>' . $s . '</li>'; }
monosnap.com/file/cluOz8BSQLTknlKaxvaspyoqfdHZOP
The following user(s) said Thank You: n00bster
Please Log in or Create an account to join the conversation.
7 years 9 months ago - 7 years 9 months ago #302025
by n00bster
Replied by n00bster on topic display custom field output in unordered list
perfect, thank you!
Last edit: 7 years 9 months ago by n00bster.
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds