We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
Subscribe: RSS
  • This is an auto-generated topic for CSS Star Rating 2.0-rc1 by splittingred.

    Brief Description:
    This snippet lets visitors to your site vote on your web articles using a completely CSS based star rating.
    • broken link
        palma non sine pulvere
      • Cascade Style Skite Reply #3, 11 years, 6 months ago
        Is there any information available about how to use this extension?

        Just using [[starRating]] does not seem te work.

        - On page-refresh the Stars disapear and the numbers 1-5 show up.
        - Rating is identical for all resources, so no per-resource results.

        When using [[!starRating]] the stars stay visible all the time but in this case rating is also identical for all resources.

        Any Idea’s?
        • Frank, you need to specify the starId parameter.

          In another question, I have find a problem like in quip, in star links and in redirect after submit a vote it lose any extra url parameters... any place to submit this issue ? Like in quip I access the resource from a sendForward.
          • I have the same problem. I cannot find the way to rate different pages, now when rating, it rates whole site.

            My call:
            [[!starRating? &docid=`[+star_rating+]`]]

            Is there something wrong with my star_rating TV properties or what?
            • If star_rating is a TV:
              [[!starRating? &docid=`[[*star_rating]]`]]

              If star_rating is a placeholder:

              [[!starRating? &docid=`[[+star_rating]]`]]
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • I’m having trouble installing the package (starrating-2.0-rc1) in Revo 2.0.0-pl rev7212. I’ve tried both downloading in the package manager and manually uploading the zip to core/packages; either way, the package shows up in the package list but the install fails.

                The behavior I see is
                1. Click on the Install button.
                2. See the usual overlay for License Agreement for an instant. No chance to press a button.
                3. See the usual overlay for Readme for an instant. No chance to press a button.
                4. I can’t remember if I see the Options overlay or not; if I do it’s the same behavior of appearing just for a moment.
                5. See the output screen for the installation process. This is the output:

                Error 23000 executing statement: INSERT INTO `modx_categories` (`parent`, `category`) VALUES (’0’, ’StarRating’) Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry ’StarRating’ for key 2 )
                Error saving vehicle object: Array ( [action] => install [signature] => 0aaf03ba91c7c760d4385b23514ee310 [register] => mgr [topic] => /workspace/package/install/starrating-2.0-rc1/ [HTTP_MODAUTH] => modx4c8056ddae3178.47480482 [package_action] => 0 [vehicle_package] => transport [vehicle_class] => xPDOObjectVehicle [class] => modCategory [guid] => 74eedeef39216c2b53cb50d949bf4f58 [native_key] => 1 [filename] => modCategory/0aaf03ba91c7c760d4385b23514ee310.vehicle [namespace] => starrating [unique_key] => category [preserve_keys] => [update_object] => 1 [related_objects] => Array ( [Chunks] => Array ( [499629fa13f9007262edf14c8a6d1fa5] => Array ( [preserve_keys] => [update_object] => 1 [unique_key] => name [class] => modChunk [object] => {"id":null,"name":"starTpl","description":"Star Rating Default Template","editor_type":0,"category":0,"cache_type":0,"snippet":"[[+rating]]Votes: [[+vote_count]]<\/span>","locked":0,"properties":null} [guid] => 16321d90e58910aab7eb03bb29a0a83e [native_key] => [signature] => d21f3d3bbe63b42f73224f3ce590c8dc ) ) [Snippets] => Array ( [4b5b52f561ad1d86861fefac36d70702] => Array ( [preserve_keys] => [update_object] => 1 [unique_key] => name [class] => modSnippet [object] => {"id":null,"name":"starRating","description":"Star Rating for MODx Revolution 2.0.0","editor_type":0,"category":0,"cache_type":0,"snippet":"\/**\n * Star Rating snippet\n *\n * @package star_rating\n *\/\n$snippetPath = $modx->getOption(’core_path’).’components\/star_rating\/’;\n$modx->addPackage(’star_rating’,$snippetPath.’model\/’);\n\n$manager = $modx->getManager();\n$manager->createObjectContainer(’starRating’);\n\n$starId = isset($starId) ? $starId : null;\n$groupId = isset($groupId) ? $groupId : ’’;\n\n$c = $modx->newQuery(’starRating’);\n$c->where(array(’star_id’ => $starId));\nif ($groupId != ’’) $c->where(array(’group_id’ => $groupId));\n\n$starRating = $modx->getObject(’starRating’, $c);\nif ($starRating == null) {\n $starRating = $modx->newObject(’starRating’);\n $starRating->set(’star_id’,$starId);\n $starRating->set(’group_id’,$groupId);\n}\n$starRating->initialize();\n\n\/* parameters *\/\n$starRating->setConfig($scriptProperties);\n\n\/* process star rating *\/\n$starRating->loadTheme();\n\n$groupIdCheck = isset($_GET[’group_id’]) && $starRating->get(’group_id’) !== $_GET[’group_id’] ? false : true;\n\nif (isset($_GET[’vote’]) && isset($_GET[’star_id’]) && $starRating->get(’star_id’) == $_GET[’star_id’] && $groupIdCheck) {\n $starRating->setVote($_GET[’vote’]);\n $starRating->addVote();\n $modx->sendRedirect($starRating->getRedirectUrl());\n}\n\nreturn $starRating->renderVote();","locked":0,"properties":"a:13:{s:6:\"starId\";a:5:{s:4:\"name\";s:6:\"starId\";s:4:\"desc\";s:44:\"The unique ID for this specific star rating.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:1:\"1\";}s:7:\"groupId\";a:5:{s:4:\"name\";s:7:\"groupId\";s:4:\"desc\";s:46:\"An optional ID to group star ratings together.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:1:\"1\";}s:8:\"maxStars\";a:5:{s:4:\"name\";s:8:\"maxStars\";s:4:\"desc\";s:36:\"The number of stars used in ranking.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:1:\"5\";}s:7:\"starTpl\";a:5:{s:4:\"name\";s:7:\"starTpl\";s:4:\"desc\";s:53:\"The name of the Chunk to use for rendering the stars.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:7:\"starTpl\";}s:5:\"theme\";a:5:{s:4:\"name\";s:5:\"theme\";s:4:\"desc\";s:17:\"The theme to use.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:7:\"default\";}s:8:\"imgWidth\";a:5:{s:4:\"name\";s:8:\"imgWidth\";s:4:\"desc\";s:29:\"The width of the star images.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:2:\"25\";}s:7:\"cssFile\";a:5:{s:4:\"name\";s:7:\"cssFile\";s:4:\"desc\";s:32:\"The name of the css file to use.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:4:\"star\";}s:9:\"urlPrefix\";a:5:{s:4:\"name\";s:9:\"urlPrefix\";s:4:\"desc\";s:52:\"This will prefix this value to any Star Rating URLs.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:0:\"\";}s:10:\"useSession\";a:5:{s:4:\"name\";s:10:\"useSession\";s:4:\"desc\";s:52:\"If true, will use session to prevent multiple votes.\";s:4:\"type\";s:13:\"combo-boolean\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:1:\"1\";}s:11:\"sessionName\";a:5:{s:4:\"name\";s:11:\"sessionName\";s:4:\"desc\";s:67:\"If useSession is true, this will be the name of the session to use.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:10:\"starrating\";}s:9:\"useCookie\";a:5:{s:4:\"name\";s:9:\"useCookie\";s:4:\"desc\";s:51:\"If true, will use cookie to prevent multiple votes.\";s:4:\"type\";s:13:\"combo-boolean\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:1:\"0\";}s:10:\"cookieName\";a:5:{s:4:\"name\";s:10:\"cookieName\";s:4:\"desc\";s:51:\"If useCookie is true, this will be the cookie name.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:11:\"starrrating\";}s:12:\"cookieExpiry\";a:5:{s:4:\"name\";s:12:\"cookieExpiry\";s:4:\"desc\";s:45:\"The expiration time in seconds of the cookie.\";s:4:\"type\";s:9:\"textfield\";s:7:\"options\";s:0:\"\";s:5:\"value\";s:6:\"608400\";}}","moduleguid":""} [guid] => 912fa3f7ab4df498b320adcb971747aa [native_key] => [signature] => e215fcd38a4e686c42effdad89a56455 ) ) ) [related_object_attributes] => Array ( [Snippets] => Array ( [preserve_keys] => [update_object] => 1 [unique_key] => name ) [Chunks] => Array ( [preserve_keys] => [update_object] => 1 [unique_key] => name ) ) [resolve] => Array ( [0] => Array ( [type] => file [body] => {"source":"starrating-2.0-rc1\/modCategory\/0aaf03ba91c7c760d4385b23514ee310\/0\/","target":"return MODX_CORE_PATH . ’components\/’;","name":"star_rating"} ) [1] => Array ( [type] => file [body] => {"source":"starrating-2.0-rc1\/modCategory\/0aaf03ba91c7c760d4385b23514ee310\/1\/","target":"return MODX_ASSETS_PATH . ’components\/’;","name":"star_rating"} ) ) [validate] => [package] => modx [object] => {"id":1,"parent":0,"category":"StarRating"} )
                Successfully installed package starrating-2.0-rc1
                Package found...now preparing to install.
                Attempting to install package with signature: starrating-2.0-rc1
                Principal 2 does not have access to requested object of class modCategory with primary key 5
                Grabbing package workspace...
                Workspace environment initiated, now installing package...

                I notice there’s an error referring to duplicate entries in modx_categories. I’m pretty sure that’s an artifact of previous failed attempts. But the "Error saving vehicle object" has always been the same, from the first attempt.

                Here’s some system info:
                ModX Revo 2.0.0-pl rev7212 (traditional)
                Intel(R) Xeon(R) CPU E5405 @ 2.00GHz
                CentOS release 5.5 (Final)
                GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
                mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using readline 5.1
                PHP 5.2.11 (cli) (built: Oct 2 2009 04:02:20)
                Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

                • Im sorry, I must be being a bit daft. I too am having problems stopping the same star rating from appearing on all pages - I have tried putting both versions of the call in to my base template - the rating appears across all pages - can someone explain what Im doing wrong? and what is the TV versiona and the placeholder version?

                  • [[!starRating? &starId=`[[*id]]`]]

                    is the right way to call it. You can see in the snippet code the var is called starId.
                    • Quote from: Erwin537 at Oct 13, 2010, 08:29 PM

                      [[!starRating? &starId=`[[*id]]`]]

                      is the right way to call it. You can see in the snippet code the var is called starId.
                      Yep, this worked for me. Revolution 2.0.4-pl2