Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You haven't set <code>$this-&gt;ua</code> to anything. I assume it's a variable of the detector library you loaded, so you probably want to do something like this:</p> <pre><code>class Deetector { public function __construct() { $this-&gt;EE =&amp; get_instance(); // remove this line, it's probably not doing anything // $this-&gt;EE-&gt;load-&gt;add_package_path(PATH_THIRD.'/deetector'); $this-&gt;EE-&gt;load-&gt;library('detector'); // note you use $this-&gt;return_data instead of "return blah" in the constructor $this-&gt;return_data = $this-&gt;EE-&gt;detector-&gt;ua; } // remove this, you can't have both __construct() and deetector(), they mean the same thing // public function deetector() // { // return $ua-&gt;ua; // } public function user_agent() { return $this-&gt;EE-&gt;detector-&gt;ua; } } </code></pre> <p><strong>UPDATE:</strong></p> <p>I took a look at the <a href="https://github.com/dmolsen/Detector/wiki/Adding-&amp;-Using-Detector-With-Your-Application" rel="nofollow">Detector docs</a>, and it doesn't follow normal library conventions (it defines the $ua variable when you include the file). For that reason you should ignore the standard EE load functions, and include the file directly:</p> <pre><code>class Deetector { public function __construct() { $this-&gt;EE =&amp; get_instance(); // manually include the detector library include(PATH_THIRD.'/deetector/libraries/detector.php'); // save the local $ua variable so we can use it in other functions further down $this-&gt;ua = $ua; // output the user agent in our template $this-&gt;return_data = $this-&gt;ua-&gt;ua; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload