Create a New Video SEO Pattern in Clip-Bucket v2

Hello,

Bored of the default video SEO patterns Clip-Bucket has? Want your site to look different from all the hundreds of websites using Clip-Bucket? Well, you’ve arrived to the right place! This time I will give you instructions on how to create your customized videos SEO pattern. This was tested under v2.6, yet should work for the whole v2 branch.

+For this example, we will create a pattern like: http://yoursite.tld/V/Our-Video-Title

+Backup all the files to be edited so you can restore changes.

+If you get stuck at any point, please do not hesitate to contact me.

1. Open ./includes/classes/video.class.php
2. Find:

function get_video($vid,$file=false)

3. Replace the former with:

function get_video($vid=NULL,$file=false,$vtit=NULL)

4. Go to line 104 or find:

$results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.videokey='$vid'")." AND ".tbl("video.userid=").tbl("users.userid"));

5. After that paste: (Here we are retrieving the video that has $vtit title):

if($vtit!=NULL) {
                $results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.title='$vtit'")." AND ".tbl("video.userid=").tbl("users.userid"));
            }

** Our whole get_video function should now look like this:

/**
     * Function used to get video data
     */
    function get_video($vid=NULL,$file=false,$vtit=NULL)
    {
        global $db;

        $userFields = "users.userid,users.username,users.avatar,users.avatar_url,users.email";

        if(!$file)
        {
            if(is_numeric($vid))
                $results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.videoid='$vid'")." AND ".tbl("video.userid=").tbl("users.userid"));
            else
                $results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.videokey='$vid'")." AND ".tbl("video.userid=").tbl("users.userid"));

            if($vtit!=NULL) {
                $results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.title='$vtit'")." AND ".tbl("video.userid=").tbl("users.userid"));
            }
        }else
        {
            $results = $db->select(tbl("video,users"),tbl("video.*,$userFields"),tbl("video.file_name='$vid'")." AND ".tbl("video.userid=").tbl("users.userid"));
        }

        if($db->num_rows>0)
        {
            return $results[0];
        }else{
            return false;
        }
    }

Now…

1. Open ./watch_video.php
2. Find:

$vkey = @$_GET['v']; 
$vdo = $cbvid->get_video($vkey);

3. Replace it with: (Here we are replacing hyphens with spaces from the t var sent by .htaccess)

if(!isset($_GET['t'])) {
    $vkey = @$_GET['v'];
    $vdo = $cbvid->get_video($vkey);
    } else {
    $vtit = str_replace("-"," ",@$_GET['t']);
    $vdo = $cbvid->get_video('',false,$vtit);
}

Then…

1. Open ./includes/functions.php (if you don’t have the functions file separated in functions1, functions2, etc; if you do have the functions file separated, go one by one until you find the code on the next step.)
2. Go to line 872 or find:

$link = BASEURL.'/video/'.$vdetails['videoid'].'_'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist;

3. After the next:

break;

which for me is on line 874, add the following case:

case 4:
                {
                    $link = BASEURL.'/V/'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist;
                }
                break;

Next…

1. Open ./.htaccess (may be hidden)
2. Find:

RewriteRule ^video/([0-9]+)_(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]

3. After that, add our new rewrite rule:

RewriteRule ^V/(.*) watch_video.php?t=$1&%{QUERY_STRING} [L]

Now, to be able to select it through the admin_area, do the following:

1. Open ./admin_area/styles/cbv2/layout/main.html
2. Find:

{$baseurl}/video/123_video-title</label>

3. After that, add:

<label> 
                  <input type="radio" name="seo_vido_url" value="4" id="seo_vido_url_4" 
                   {if $row.seo_vido_url==4} checked="checked"{/if}/> 
                  {$baseurl}/V/video-title</label>

Finally..

1. Open phpMyAdmin or any DB Manager you use
2. Execute the following query to make our script use our type 4 of seo pattern (the case we previously added):

UPDATE `cb_config` SET `value` = '4' WHERE `cb_config`.`name` ='seo_vido_url';

*Remember to change cb_ if you changed our table prefix during CB installation.

There you go. Save and Upload everything, overwriting when prompted to. If for any reason you would like to revert changes, just restore from the backup you did at the start. Any question, comment, suggestion is greatly appreciated, so don’t forget to leave it down below at the comments section!

Best Regards,

Richi

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

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

Author Spotlight

Richi González

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 became a Liaison between Arvixe and Clip-Bucket, so I am here to assist you with anything you need regarding Clip-Bucket or any particular computer-related subject you need. Best Regards, Richi

Leave a Reply

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


4 × = 8

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>