How to make a text string into a bullet list

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: How to make a text string into a bullet list

Post by seandisanti » Mon Apr 01, 2013 8:42 am

$countries ='USA, Canada, Japan, Russia';
//string looks like this: "USA, Canada, Japan, Russia"
$array = explode(",", $countries);

if ( ! empty( $countries ) ) {
echo '<ul>';
foreach ( $array as $country ) {
echo '<li>' . $country . '</li>';
}
echo '</ul>';
}

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: How to make a text string into a bullet list

Post by seandisanti » Mon Apr 01, 2013 10:24 am

I saw that, but i went with a literal string since i don't have access to that function, or your database. assuming your function call returns a comma delimited string as your comment implied, you should be able to just drop your function call back in there. if that doesn't work, then add: die($countries) right after that line to see what your function is actually returning.

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: How to make a text string into a bullet list

Post by seandisanti » Mon Apr 01, 2013 10:59 am

usually that means you've missed a semi colon or you've got an unterminated string; at the end of the line before the one referenced. so probably on or around line 37 in /home/content/59/9161159/html/wp-content/themes/parallelus-razor/members/single/profile/profile-loop.php

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest