Welcome Guest, Not a member yet? Register   Sign In
Where to put this 3rd party PHP package?
#6

[eluser]mhulse[/eluser]
So, this was pretty quick and dirty, and I am about ready to head to bed, but I thought I would post my results for feedback. Smile

1. I put the ColorJizz.php library in the CI "libraries" folder.

2. I then created a new class named "Hexed" (Hexed.php) and put that in the CI "libraries" folder also.

Contents of Hexed:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Hexed {
    
    function __construct()
    {
        
        require_once('ColorJizz.php');
        
    }
    
    public function jizzed($val)
    {
        
        return new Hex($val);
        
    }
    
}

In my (default, out of the box) controller, I have this:

Code:
<?php

class Welcome extends Controller {
    
    private $data;
    
    function Welcome()
    {
        parent::Controller();
        
        $this->load->library('hexed');
        
    }
    
    function index()
    {
        
        
        $white = $this->hexed->jizzed(0xffffff);
        $black = $this->hexed->jizzed(0x000000);
        $blue = $this->hexed->jizzed(0x2491B5);
        
        /* ....snip.... */
        
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

That appears to work!

I would definitely be interested in hearing how I can improve the code. Thoughts?

Thank you!!!

Cheers,
Micky


Messages In This Thread
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 02:20 AM
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 03:39 AM
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 03:42 AM
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 04:01 AM
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 10:36 AM
Where to put this 3rd party PHP package? - by El Forum - 10-19-2010, 10:29 PM
Where to put this 3rd party PHP package? - by El Forum - 10-20-2010, 03:07 AM
Where to put this 3rd party PHP package? - by El Forum - 10-20-2010, 11:08 AM
Where to put this 3rd party PHP package? - by El Forum - 10-20-2010, 12:35 PM
Where to put this 3rd party PHP package? - by El Forum - 10-20-2010, 12:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB