Jump to content

Output items separated by comma apart from last item


Peter Knight
 Share

Recommended Posts

Hi

I have a page reference field which are a series of checkboxes in the back end

  • Web Design
  • Web Development
  • Marketing
  • Administration

In my template I was previously listing only 1 key skill at a time but now I need to output each checked item separated by a comma

IE

Marketing, Administration

This does work but echoes 

Marketing, Administration,

 foreach
                        ($staff->skills as $item){
                        echo "{$item->title},";}

How would I keep the comma from appearing at the end of the last item?

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...