Limit Friends Shown in the User Channel in Clip-Bucket v2


If you want to set a limit of how many friends are shown in each user channel, then keep reading this article. The question was originally posted at the Clip-Bucket forum and answered there by me, so I asked myself ‘why don’t you write an article about this?’ This article is tested to work in v2.6, but the essence is the same for any CB version or any Smarty powered template. See the following image to see the listing we are going to limit.


1. Open channel_left.html, located inside ./styles/cbv2new/layout/*

2. Find

{foreach from=$userFriends item=friend}

3. Assign the foreach loop a name (in this case friendsloop). Replace it with:

{foreach from=$userFriends item=friend name=friendsloop}

4. We will use Smarty index to get the current iteration of the loop (read more here: Create the if to check the current index, if it is less than our limit (10) keep showing friends:

{if $smarty.foreach.friendsloop.index < 10}

Replace 10 with your desired limit.

5. After that if check, add the include that was previously there, making our foreach loop look like this:

	{foreach from=$userFriends item=friend name=friendsloop}
		{if $smarty.foreach.friendsloop.index < 10}
			{include file="$style_dir/blocks/user.html" user=$friend block_type="friends"}

Remember to close the if with {/if}


And that’s all. If you have any problem or question at any step, please do not hesitate to contact me and I’ll be more than glad to assist you.

Best Regards,


Looking for quality ClipBucket Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , , | Posted under ClipBucket | RSS 2.0

Author Spotlight

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I'm the Liaison between Arvixe and Clip-Bucket, so anything you need regarding Clip-Bucket or any particular computer-related subject you need, let me know so I can assist you.

Leave a Reply

Your email address will not be published. Required fields are marked *