We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7923
    • 4,213 Posts
    Hi, I’ve made a snippet what gets some of the bbclone stats to your site (click to see bbclone in action). This is an ongoing project, I’ll try to get the totals page done next and after that (done), I will try to make these more template driven.

    The output of this snippet is pretty configurable in the current state too. Here’s some instructions how to get this done:

    First you need to install BBClone:


    • 1. Download BBClone from http://bbclone.de/download.php
    • 2. Download newest IP2EXT from http://bbclone.de/download.php?sub=ip2ext
    • 3. Extract both packages and copy the new ip2ext folder inside the bbclone folder overwriting old files

    • 4. Upload the bbclone directory to your webserver (can be anywhere you want)[list][li]NOTE: You can rename the bbclone folder if you want!
    [/li][li]5. CHMOD all files inside bbclone/var/ to 0666, exept .htaccess file![/li]
    [li]6. Paste the following code to the bottom of modx index.php (tried to do this as a plugin but did not succeed, could someone help?)
    • NOTE: Edit the $bbclone_path to point to your bbclone folder!
    [/li]
    [/list]
    $page_title=$modx->documentObject['pagetitle'];
    $bbclone_path=$modx->config['$base_path']."bbclone/";
    define("_BBC_PAGE_NAME", "$page_title");
    define("_BBCLONE_DIR", $bbclone_path);
    define("COUNTER", _BBCLONE_DIR."mark_page.php");
    if (is_readable(COUNTER)) include_once(COUNTER);

    • 7. Configure BBClone to work the way you want by editing the file bbclone/conf/config.php (ie. count only unique visitors, hide config information, etc) Read the manual about configuration settings at http://help.bbclone.de/index.php?n=Config.HomePage

    After you have installed BBClone, go and visit your site and then point your browser to the bbclone url (ie. www.somedomain.com/bbclone). You should see your visit details in bbclone now.

    Now to the snippets:

    With the attached snippets, you can get the time stats and global stats of bbclone to your page. The code is pretty much the same as show_time.php and show_global.php in bbclone and I really can’t take any credits of it. I just modified them to work as a snippet and made some css changes so you can customize the look of it to fit your desing.

    There are some configuration setting at the start of the snippets. They are commented and it should be clear how to use them, but feel free to ask if you have any problems!

    Snippet Installation:

    bbclone_show_time

    • 1. Copy the content of bbclone_show_time.txt to a new snippet and name it
    • 2. Change the paths at the start of the snippet to point to correct locations
    • 3. Change the graph print sizes (if needed)
    • 4. Copy the content of bbclone_show_time.css to the HEAD of your template or to your css file (but edit out the <style> tags if you put it in a external css file)
    • 5. Change the colors in the css to fit your color scheme, there are comments to tell what class is for what
    • 6. Call your snippet in some document and see the results

    bbclone_show_global

    • 1. Copy the content of bbclone_show_global.txt to a new snippet and name it
    • 2. Change the paths at the start of the snippet to point to correct locations
    • 3. Set the other configurable values to be the same as in bbclone config file
    • 4. Call your snippet in some document and see the results (uses same css as the snippet above)

    If you are an advanced user, you can easily modify the whole output of the snippets by changing the return strings of them.. the functions returns content in tables. That’s it for now.. smiley

    EDIT: Added show_global, you should reload the show_time snippet also, made some slight changes.


      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
      • 6726
      • 7,075 Posts
      Doze : thanks a LOT for this one... I love BBClone, much more features than Slimstat, but still lightweight and I am used to it...

      I’ll test this as soon as possible and report, I am really excited about this snippet !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
        • 7923
        • 4,213 Posts
        Added the bbclone_show_global snippet..


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 16885
          • 255 Posts
          Kicking this one to the top, as it’s still not in the repository, and imho it’s way better than slimstat as you can actually show it nicely on the frontend.

          Has anyone got a little hint on how to form this code into a plugin? The fileedits aren’t ideal with all my upgrading on MODx...
          So far I’ve tried using the code on kinda like all the possible web events, but it didn’t turn out to work, sadly.
            • 22815
            • 1,097 Posts
            Hmmn. Really there should be a suitable plugin point for this, but I don’t know what it is. Editing index.php isn’t a great deal of hackery though. Thanks for bringing this up though, it’s just what I needed for something.
              No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!
              • 26074
              • 121 Posts
              Is there an authentication system for bbclone?
                ___________________________________________________________________
                ..:: Samuele ::..
                • 16885
                • 255 Posts
                Nope, you could protect its directory with a .htaccess or similiar thing though, but I don’t see how that is useful, simply picking an uncommon name should do as well wink
                  • 476
                  • 14 Posts
                  Hi Doze! I installed BBClone at my site www.amdias.com but i’ve found that IE users were marked as Netscape... I went to BBClone forum, but no one knew the problem.

                  So i’ve found that in index.php of MODx there was this piece of code:
                  $_SERVER['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? preg_replace("/[^A-Za-z0-9_\-\,\.\/\s]/", "", $_SERVER['HTTP_USER_AGENT']): '';
                  $_SERVER['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? preg_replace($modxtags,"", $_SERVER['HTTP_REFERER']) : '';
                  


                  Because of this convertions, BBClone, called at the end of the index.php can’t work properly.

                  The only way to BBClone work without problems is doing something like this:
                  $HTTP_USER_AGENT = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
                  $HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
                  


                  Before

                  $_SERVER['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? preg_replace("/[^A-Za-z0-9_\-\,\.\/\s]/", "", $_SERVER['HTTP_USER_AGENT']): '';
                  $_SERVER['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? preg_replace($modxtags,"", $_SERVER['HTTP_REFERER']) : '';
                  


                  Finaly, at the end of index.php:
                  $_SERVER['HTTP_USER_AGENT'] = $HTTP_USER_AGENT;
                  $_SERVER['HTTP_REFERER'] = $HTTP_REFERER;
                  
                  $page_title=$modx->documentObject['pagetitle'];
                  $bbclone_path=$modx->config['$base_path']."stats/";
                  define("_BBC_PAGE_NAME", "$page_title");
                  define("_BBCLONE_DIR", $bbclone_path);
                  define("COUNTER", _BBCLONE_DIR."mark_page.php");
                  if (is_readable(COUNTER)) include_once(COUNTER);
                  



                  And thats it! I hope this will be usefull to someone!
                  Sorry my english, regards,
                  ADias
                    • 22815
                    • 1,097 Posts
                    adias, that’s excellent. I only tried BBClone briefly and wondered why a lot of Netscape users seemed to be hitting my site - I’ll try these instructions later and hopefully it will make a difference.
                      No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                      Forum: Where to post threads about add-ons | Forum Rules
                      Like MODx? donate (and/or share your resources)
                      Like me? See my Amazon wishlist
                      MODx "Most Promising CMS" - so appropriate!
                      • 7923
                      • 4,213 Posts
                      Yea, thanks for that.. I’m a bit unimpressed with bbclone after I have been using it for a while.. It seems that it somehow finds a way to corrupt it’s own data files and then the whole logging breaks.. Have anyone else had that? When I clear the data files, it works for some time, but then I start to get this error message randomly on my pages:


                      Parse error: syntax error, unexpected $end, expecting ’)’ in /www/path/to/modx/bbclone/var/last.php on line 109

                      I looked littlebit of the code that is used to write the data files (mark_page.php) and it looks that they have tried to do some semaphores to that to prevent writing the file more than one times simultaneously, but either it’s not working in my server enviroment or something else is failing with it... anyways, I’m not going to develop this further because of that.

                      I’ve been looking at Google Analytics and hoping that they do some api to it.. that would rock.


                        "He can have a lollipop any time he wants to. That's what it means to be a programmer."