We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    Here is an 0.9.5-compatible version of a component I whipped up tonight for a site with a Flash splash page that I only wanted to show once, and only to users with browsers supporting both JavaScript and cookies. This BrowsercapSplash plugin uses a slightly modified version of a component called Browsercap (see http://garetjax.info/projects/browscap/), a PHP interface to the Browser Capabilities Project (see http://browsers.garykeith.com/index.asp), and can probably used for any number of useful browser type and capabilities detection. I only slightly modified the PHP 4 release (0.4) of Browscap PHP, so it can be used in MODx regardless of PHP version.

    Some pointers...
    [*] Extract the zip to your /assets/plugins/ directory
    [*] Copy the contents of the plugin.snippet.php file to a new plugin in the manager (minus the opening <?php tag)
    [*] Make the /assets/plugins/browscap/cache/ directory writable; this is important so you don’t continually hit Gary Keith’s update server constant.
    [*] Additional notes and hints in the plugin.snippet.php comments.
    [*] There is a non-commercial attribution share-alike license on the browscap.ini database itself, so make sure you review the terms and conditions before utilizing the Browscap class to access this data. (but you can contact him directly for permission to use it commercially or if you plan to be hitting his server for updates frequently for some reason)

    Let me know if you have any questions or problems using this.

    Cheers...
      • 31227
      • 198 Posts
      hey,
      great plug-in although I am having problems implementing it:(
      here is what I did - uploaded the files provided, chmod cache 777 (just to be sure), added a new plug in and copy and pasted the contents of plugin.splash.php and added the following in the configuration
      &
      =undefined;;    &splashPageId=2;; &browscapCachePath=Browscap Cachepath;string;assets/cache/browscap/

      and i’ve set the system events: OnWebPageInit OnWebPagePrerender.
      My flash intro is id2. How do I call this plug in cause otherwise it doesnt work:(
        Pure MODx sites
        Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
        • 22303 MODX Staff
        • 10,725 Posts
        You have the configuration messed up. Copy and paste each line of the plugin config separately...I hate that interface for plugin parameters myself. It definitely needs to be fixed. When you enter the properties correctly, you’ll see editors show up below the list so you can easily change the values via a form field...

        &splashPageId=Splash Page Id;string;19
        &browscapCachePath=Browscap Cachepath;string;assets/cache/browscap/


        The second parameter is optional only necessary if you are using a directory other than /assets/plugins/browscap/cache/ for the location of the Browscap cache.
          • 31227
          • 198 Posts
          is it possible to set more than 1 splash page(multi-lang site)?
          also, how can I get the visitor to see the intro if he wishes to do so?
            Pure MODx sites
            Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
            • 31227
            • 198 Posts
            Copied & pasted exactly as you told me now now I get this:
            « MODx Parse Error »
            MODx encountered the following error while attempting to parse the requested resource:
            « PHP Parse Error »
             
            PHP error debug
              Error:  fsockopen() [function.fsockopen]: unable to connect to browsers.garykeith.com:80 (Connection timed out) 
              Error type/ Nr.:  Warning - 2 
              File:  /home/kotua/domains/viriko.com/public_html/assets/plugins/browscap/browscap.class.php 
              Line:  301 
              Line 301 source:  $remote_handler = fsockopen($remote_url[’host’], 80, $c, $e, $this->timeout);   
             
            Parser timing
              MySQL:  0.0178 s (1 Requests)
              PHP:  2.0861 s 
              Total:  2.1039 s 

            Why is it trying to connect to an outside source? is it possible to download the files needed and put them on my server?
              Pure MODx sites
              Viriko.ru & Viriko.com - Multilingual and running on 1 MODx