Welcome Guest, Not a member yet? Register   Sign In
How to use WhichBrowser as a library??
#1

There is this plugin(WhichBrowser->www.whichbrowser.net) i want to use in my project. Sorry i can't use composer because my host doesn't allow it. This is how it goes by:
Code:
<?php
// libraries/parse.php

//uncomment this and it prints(No direct script access allowed!)

/*
if(!defined(BASEPATH))
exit('No direct script access allowed!');
*/
use WhichBrowser\Parser;

require_once APPPATH.'third_party/Parser-2.0.16/bootstrap.php';

//class Parse{

class Parse extends Parser{

/**/
//public function __construct(){
//self::Parser($_SERVER['HTTP_USER_AGENT']);

//require_once APPPATH.'third_party/Parser-2.0.16/bootstrap.php';


//    }
/**/

}

in my controller's index method:
Code:
$this->load->library('parse', $_SERVER['HTTP_USER_AGENT']);
echo 'You are using: '.$this->parse->toString(); // prints 'You are usng an unknown browser' instead of 'You are using Opera Mini 8.0 on Nokia C3-00 running Series40'
anyway to fix this??
Be Simple Angel
Reply


Messages In This Thread
How to use WhichBrowser as a library?? - by waptik - 03-27-2016, 11:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB