We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    My needs are even simpler than that, since there is no form; just clicking on the button triggers the AJAX to increment the vote count for that item. I just need to compare the IP, if it’s in the array then check the time it was put there, if it is less than X amount of time, don’t do anything at all; if it’s not in the array or the time it’s been there is greater than X amount of time, increment the vote count and add it to the ban list or update its timestamp. I’ll have fresh voting every month or something like that, so IPs will need to be cleared at the end of every month/voting period. Just some simple queries and a few if conditionals, but it’s too hot right now to try to focus that much tongue

    So... which sweater should I make my partner this fall? http://www.sottwell.com/petshop/en/gallery.html
      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
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Here’s the article, with code http://sottwell.com/e2g-plugin.html
        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
        • 16702 ☆ A M B ☆
        • 536 Posts
        Quote from: sottwell at Aug 07, 2010, 12:51 PM

        Here’s the article, with code http://sottwell.com/e2g-plugin.html

        if i click 47 times what happens?
        grin
          palma non sine pulvere
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          My partner will probably end up getting that sweater grin

          That’s why I’ve mentioned using the visitor’s IP address to limit voting; I just haven’t gotten around to implementing that part yet.
            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
            • 11055 ☆ A M B ☆
            • 3,112 Posts
            my best suggestion is that you would like to try to create a custom gallery’s template, and use form in it.
            <div class="e2g_wrapper">
                [+easy2:permalink+]
                <div class="e2g_gallery" id="e2g_gallery_[+easy2:sid+]">
                    <form action="" method="POST">
                    [+easy2:content+]
                    </form>
                </div>
            </div>
            


            Then you could start create radio options for the voting in the thumbnail’s template, since it would only allow you to choose one option.

            Another thing,
            I think you should put $ip = $_SERVER["REMOTE_ADDR"]; in the plugin, too, which where will filter whether the visitor has make a vote or not, and react as so.

            Another more thing,
            There is a $_SESSION[’e2g_instances’] variable (which is generated by easy2’s plugin, not the snippet) that’s identified in the template as [+easy2:sid+].
            This variable will apply a different ID to each of snippet calls, starts from 1 (one), and will be reset to 0 (zero) on the ’OnWebPageComplete’ event.
            I don’t have any idea how to implement this inside your code, but it might be useful if you want to call snippet+yourPlugin more than once on one page.
              Rico
              Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
              MODx is great, but knowing how to use it well makes it perfect!

              www.virtudraft.com

              Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

              Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

              Maintainter/contributor of Babel

              Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
              • 29256
              • 20 Posts
              Hy

              I use easy2gallery-1.4.0-rc1-r246.
              I have in my gallery (http://www.clubyoko.hu/galeria.html) more 9.000 pictures and sometimes it is relly slow.
              PHP: 7-24s generated.
              I tryed cached call: [[easy2]] but it isn’t work.
              Only the main page show. I can’t enter in the sub gallerys.

              I need help!
              Thanks everything.

              Sorry my bad english.
                • 11055 ☆ A M B ☆
                • 3,112 Posts
                what is your snippet call?

                edit:
                it looks like you’re using the BIG images as 1600x1200 pixels.
                try to lower them down, at least as wide as your website’s design.
                  Rico
                  Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                  MODx is great, but knowing how to use it well makes it perfect!

                  www.virtudraft.com

                  Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                  Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                  Maintainter/contributor of Babel

                  Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                  • 29256
                  • 20 Posts
                  Quote from: goldsky at Aug 09, 2010, 09:58 AM

                  what is your snippet call?

                  edit:
                  it looks like you’re using the BIG images as 1600x1200 pixels.
                  try to lower them down, at least as wide as your website’s design.

                  Hy!

                  My snippet call: [!easy2? &img_src=original!]
                  but the older gallery has got lower images.
                  The 3 newest gallerys have got big images.

                  Sorry for my bad english.
                    • 11055 ☆ A M B ☆
                    • 3,112 Posts
                    All the newest 3 galleries (2010.08.07-club-yoko, 2010.08.06-lvg-retro, 2010.07.31) use 1600x1200 pixels.

                    Do you really need the images that big?

                    You are using 5x4 grid.
                    That means that the snippet will retrieve 20 pictures with 1600x1200 pixel for completing the web page.
                    It becomes a natural internet connection issue, not the Easy 2 Gallery issue, if you put 20 picture x 841 KB = 16,820 MB (woowww... it IS big!), on one page.

                    I know that’s why you use &img_src=`original` to avoid double space.
                    So what you need is to resize all the images again to a smaller size, and also perhaps reduce the grid size, may be 5x3 grid.

                    One trick of the massive resizing,
                    I use XnView (for WindowsXP) for this kind of job.
                    And it’s free! grin grin
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 29256
                      • 20 Posts
                      Quote from: goldsky at Aug 09, 2010, 07:55 PM

                      All the newest 3 galleries (2010.08.07-club-yoko, 2010.08.06-lvg-retro, 2010.07.31) use 1600x1200 pixels.

                      Do you really need the images that big?

                      You are using 5x4 grid.
                      That means that the snippet will retrieve 20 pictures with 1600x1200 pixel for completing the web page.
                      It becomes a natural internet connection issue, not the Easy 2 Gallery issue, if you put 20 picture x 841 KB = 16,820 MB (woowww... it IS big!), on one page.

                      I know that’s why you use &img_src=`original` to avoid double space.
                      So what you need is to resize all the images again to a smaller size, and also perhaps reduce the grid size, may be 5x3 grid.

                      One trick of the massive resizing,
                      I use XnView (for WindowsXP) for this kind of job.
                      And it’s free! grin grin

                      Hy

                      Thanks, I resize the pictures when I have free time, But:
                      Why so slow the gallery system and why can’t I cached it?

                      On the other pages the latest gallery (bottom of the page) can I cache it. I use custom template chunk,
                      but if I use custom chunk on the gallery page (clubyoko.hu/galeria.html) remain slow.

                      Sorry for my bad english.