How To Retrieve the Total Video Views in Clip-Bucket v2

Hello,

Per one of our forum’s user, I’ve created this tutorial to show you how to display the total number of video views in your Clip-Bucket v2 powered website. It will count the views of all your videos that finished converting successfully.

1. Open ./includes/classes/video.class.php
2. Before the ending

}
?>

, add the following function:

	function getTotalViews() {
		global $db;
		$result = $db->select(tbl("video"),"views", " status= 'Sucessful'");
		$totalviews = 0;
		while($result) {
			$totalviews = $totalviews + $result['views'];
		}
		return $totalviews;
	}

3. Save
To display this in your template, for example on your homepage, do the following:
4. Open ./styles/{TEMPLATE}/layout/index.html
5. Add the following code at the top:

{assign var=total_views value=cbvid->getTotalViews()}

6. Display the value anywhere using {$total_views}
7. Save & Upload

And that’s it! If you get stuck at any step or have any questions, please let me know. Moreover, if you’d like me to cover any specific Clip-Bucket related topic, just let me know and I’ll do my best to have it published as soon as possible.

Best Regards,
Richi González

Looking for quality Clip-Bucket hosting? Try out Arvixe and you won’t be disappointed.

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.

4 Comments on How To Retrieve the Total Video Views in Clip-Bucket v2

  1. luiggy says:

    Hi Richi,
    I want to convert Videos Views number format with comma on my homepage (if have a video with 10000 views I want to display 10,000) on Being Watched, Most Viewed, Recently Added, and on Likes.

    Thanks for your support!

    • Hello,

      Find the file where the code to display the views is, it will look something like {$views}. Just modify it to look like {$views|number_format}.

      Let me know if you have any questions.

      Regards,
      Richi

      • Luiggy says:

        Hi,
        I just find this code on cbv2new/layout/watch_video.html, (version 2.6)
        {lang code=’views’} : {$vdo.views|number_format} but I don’t find just {vdo.views} so I can add (l number_format). I would like this format on my Editor’s Pick too. Thanks.

        Luiggy

        Luiggy

  2. luiggy says:

    Hi, I just fix it.
    1. For Editor’s Pick Video Views (cbv2new/layout/blocks/editor_pick/video_block.html). Find {$video.views} change to {$video.views|number_format}.
    2. For Being Watched, Most Viewed, Recently Added (cbv2new/layout/blocks/video.html) Find
    {$video.views} change to {$video.views|number_format} and find {$video.views} change to <span {$video.views|number_format}

    That's it!

    Now I need to find how to fix Likes format that i think should be the same thing.

    Thank you for your advice,

    Luiggy

Leave a Reply

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