We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4868
    • 5 Posts
    Can somebody help me to get a Page Hit Counter 2.0.0. installed? For Evolution 1.0.4.
    I need to have the exact instructions, as a Modx newbe.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Create a new Module, copy/paste the contents of the PageHitCounter.module.php file.

      Create a new Plugin, copy/paste the contents of the CountPageHit.plugin.php file. Set the System Event to onWebPagePrerender.

      Upload the pagehitcounter folder with the getcount.php file into your assets/modules folder.

      Manager users’ visits will not be counted. Documents set to not Log Visits will not be counted.
      1. Go to Modules -> Manage Modules; create the new module there.

      2. Go to Elements -> Manage Elements, and the Plugins tab. Create the new Plugin there; use the plugin’s System Events tab to set the onWebPagePrerender event.

      If you have a specific question or problem, post it here.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4868
        • 5 Posts
        I created the module and plug-in, all done. Then I tried to upload the pagehitcounter folder with the getcount.php file into my assets/modules folder, but it is a .zip folder. Can I unpack this folder or not? ("Existing files will be overwritten.")

        That’s why I tried the following: I created a folder "Pagehitcounter" in the assets/modules folder directly, and tried to upload the getcount.php file into the assets/modules folder, but Evolution reports that uploading such files is not allowed.

        What to do?
          • 18913
          • 654 Posts
          I’d suggest using ftp to upload the contents of that zip file to the correct location. Also, if the folder name is supposed to be lowercase, make sure that is the case.

          EDIT : more explicitly, when you are done there should be a folder called
          assets/modules/pagehitcounter
          and in that folder should be the file
          getcount.php

          Matt
            • 4868
            • 5 Posts
            I did this, but when I go to the module, it reports with a screen: Please wait while MODx loads the page... and it doesn’t load. The little screen remains there forever.

            And when I load my website, I get this error:

            « MODx Parse Error »
            MODx encountered the following error while attempting to parse the requested resource:
            « Execution of a query to the database failed - Table ’zebraim_mod5.mod_page_hit_counter’ doesn’t exist »
            SQL: INSERT INTO mod_page_hit_counter (page_id, page_count) VALUES (1, 1) ON DUPLICATE KEY UPDATE page_count=page_count+1
            [Copy SQL to ClipBoard]

            The relevant table has not been created. What should I do?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              That module is six years old now. I have updated it for Evolution. All you need to do is replace the module code; the plugin still works fine as-is.

              New version attached.

              The pagehitcounter folder actually should just be removed; all it had in it is an AJAX processor for handling a display of an individual page’s count on the page. A simple snippet will be much better for this; all it needs to do is make a query to fetch the count from the database. If you want to do an AJAX display for some reason, it’s much better to use a resource with a snippet to do the processing.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org