We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10449
    • 956 Posts
    I haven’t used this class, but in regular mySQL, you’d use something like

    SELECT Vorname, Name
    FROM `warenkorb`
    WHERE LOWER( SUBSTRING( Name, 1, 1 ) )
    IN (
    'a', 'b', 'c', 'd'
    )
    ORDER BY Name ASC , Vorname ASC 
    
      • 10449
      • 956 Posts
      err, actually BETWEEN works with letters as well smiley

      SELECT Vorname, Name
      FROM `warenkorb`
      WHERE LOWER( SUBSTRING( Name, 1, 1 ) )
      BETWEEN 'a' AND 'd'
      ORDER BY Name ASC , Vorname ASC 
      
        • 24622
        • 12 Posts
        Thanks for the help. Got it to work. Also modified loopDbChunk to accept a couple more commands to make it a little easier to use for me. Now to figure out how to incorporate a search into it smiley
          Just because I don't know what I'm doing, it has never stopped my from breaking something.
          • 34017
          • 898 Posts
          rc,

          Could you post your additions so we can see them?

          Chuck
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 867
            • 241 Posts
            Hi,

            I believe there’s a small mistake in the readme file :
            2. create a new chunk named ’loopDbChunk’ and copy the content of the file ’snippet.txt’
            into it.
            Should’nt it be create a snippet instead ?

            one feature that i would love is the possibility to make a select of data matching some
            arguments like with :
            $sql = $modx->dbQuery(’select * from ’.$modx->getFullTableName(’favorite_links’). ’ where lieux = "’ . $lieux . ’" AND rubriques="Animation" ’

            anyway thanks for sharing smiley
              • 24622
              • 12 Posts
              I will be glad to upload the changes. Right now I’m in the process of modifying the chunk with a couple of other features, and as soon as I get them working I’ll upload it. Not a PHP programmer so its been a little trial and error to get it working.

                Just because I don't know what I'm doing, it has never stopped my from breaking something.
                • 1751
                • 57 Posts
                Hi
                Can anyone tell me how to get Pagination to work with this please?
                I have everything else working fine, but the placeholder area for pagination is blank every time, whether it’s in a div a paragraph or a table cell.
                I noticed a typo in the readme file which shows
                <div class="my_pagination">[+pagination]</div>
                and have tried
                [+pagination+]
                and
                [+Pagination+]
                to no avail.
                I have tried it in the chunk just in case but that doesn’t work (wouldn’t expect it to). And I have put it to no avail just after my snippet call as suggested in the readme:
                [!loopDbChunk? &tableName=`mytablename` &chunkName=`mychunkname` &numLinks=`3` &perPage=`3` &orderby=`email` !]  
                [+pagination+]


                So I’m wondering if my snippet is the updated snippet and if not, where I can get the latest?
                It was downloaded from page 1 of this thread today and is dated 4th Sept 07 (as is pagination.php which I uploaded to the /wwwroot/assets/snippets/LoopDBChunk directory together with LoopDBChunk.php dated 23rd sept and transformFuncs.php dated May 07.
                Though I can see that LoopDBChunk.php has the following in it so I think that is fine:
                		$p = new Pagination(array('per_page' => $this->perPage,
                										  'num_links' => $this->numLinks,
                										  'cur_item'  => $pageStart,	
                										  'total_rows' => $numRows	));
                		$modx->setPlaceholder('pagination', $p->create_links());
                		
                		return($output);


                Or maybe I’m just missing an obvious something?

                Any help would be much appreciated.

                Thanks

                Anni
                  • 1373
                  • 12 Posts
                  I have just released a new version of loopDbChunck (1.1) - find it in the first post of this thread.

                  The main addition in this version is a phx-like modifier:
                  You can use in the chunk something like: [+t:funcName:field_1:field_2+]
                  this is explained in the readme file...

                  One important issue I found is that snippet parameters CANNOT include the ’=’ character,
                  because of the way MODx parses those parameters.
                  So, inside a custom sql query use ’eq’ instead of ’=’.

                  Anni, this version should solve your problem.
                  Thanks for the feedback and typos correction.
                    • 25663 MODX Staff
                    • 12,272 Posts
                    I’ve seen folks use the replacement technique before, but I think just using eq by itself might cause problems... what happens if the word "sequence" comes into play? The solution I’ve seen that seems to work is using |xe| or |eq| in your case to replace equals signs. That’s the pipe character, by the way.
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 1751
                      • 57 Posts
                      Hi Amir
                      Thanks for this,
                      I’ve got the new release working great with pagination in Firefox, but for some reason it crashes ie7 and ie6 (2 different machines) - but only if I include either of the pagination parameters of &perPage and $footer. If I remove them, ie works fine but without pagination.

                      Any ideas?

                      Thanks

                      Anni