On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi, this question is about my Gallery Layout that uses slimbox. Right now it puts my thumbnails in a single column on the left. I want the thumbnails in rows instead of a single column. How do I make this happen?
    • Use CSS to style the size and positioning of the thumbnail blocks. And you will get a better response to your questions if you post them to the Gallery dedicated board.
        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
      • Hi everyone! I'm new to MODx Revolution (and to the Forum as well) and although I managed to learn a lot these days, sometimes I get stuck with things that I'm normally able to do using, for example, only PHP and MySql outside MODx. One of such things is to paginate a table.
        After a lot of search I first followed this page: https://gist.github.com/605043/646a47095c26b2788f66aaa42f597bb37ce91dea and then I could see the right output (with so many beautiful arrays) on my screen based on my query.

        Hier my snippet (dataBaseQuery):

        <?php
            $output = array();
        
            $total = 0;
            $limit = isset($limit) ? (integer) $limit : 0;
            $offset = isset($offset) ? (integer) $offset : 0;
            $totalVar = !empty($totalVar) ? $totalVar : 'total';
        
            // determine the total number of records for your criteria
            $totalStmt = $modx->query("SELECT COUNT(*) FROM table WHERE code in (574512,37770812,37770814,37770865,37770887,37770919,37770988,37772219)");
            if ($totalStmt) {
                $total = (integer) $totalStmt->fetch(PDO::FETCH_COLUMN);
                $totalStmt->closeCursor();
            }
        
            // set a placeholder for getPage to get the total for it's calculations
            $modx->setPlaceholder($totalVar, $total);
         
            // now execute your query with limit/offset if the total > 0
            if ($total > 0) {
                // NOTE: always order by a unique column when using LIMIT/OFFSET
                $sql = "SELECT auth, nr, kid, code FROM table WHERE code in (574512,37770812,37770814,37770865,37770887,37770919,37770988,37772219) ORDER BY code";
                if (!empty($limit)) {
                    $sql.= " LIMIT {$limit}, {$offset}";
                }
        
                $pdoStmt = $modx->query($sql);
                if ($pdoStmt) {
                    while ($row = $pdoStmt->fetch(PDO::FETCH_ASSOC)) {
                        $placeholders = array_merge($scriptProperties, $row);
                        if (!empty($tpl)) {
                            $output[] = $modx->getChunk($tpl, $placeholders);
                        }
                        else {
                            $output[] = "<pre>" . print_r($placeholders, true) . "</pre>";
                        }
                    }
                }
            }
            return implode("\n", $output);
        ?>



        Then I create a chunk and added following line on the top of my snippet:
        $tpl = $modx->getOption('tpl',$scriptProperties,'tablePagination');


        Hier the code of the chunk (tablePagination):

        <tr>
            <td>[[+auth]][[+nr]][[+kid]]</td><td>[[+code]]</td>
        </tr>
        


        Now when I use the snippet as follow on the page I receive the expect result, i.e. a table with my values:

        <table>
            [[dataBaseQuery]]
        </table>
        


        Now I would like to paginate it, but everything I do gives me no result.
        Reading the documentation I thought I should use this:

            [[!getPage? &element=`getResources`  &tpl=`tablePagination`]]
        


        But doing so, I receive no result and the site stays empty. What I'm doing wrong?
        Many thanks!
        • Your getPage snippet should have the properties for your snippet; the properties are passed on to the snippet. What does getResources have to do with anything? It's for listing resources, not custom tables.

          Personally, I would use MIGXdb to handle the custom tables, and use one of its listing snippets as the element for getPage. Again, the properties of getPage are the properties for the listing snippet.
            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
          • Having created a proper xpdo-schema and your model (just a view clicks with MIGXdb)

            you can do

            [[!getPage? 
            &element=`migxLoopCollection`
            &packageName=`yourPackage`
            &classname=`yourXpdoClass`
            &where=`{"code:IN":[574512,37770812,37770814,37770865,37770887,37770919,37770988,37772219]}`  
            &tpl=`tablePagination`
            &limit=`10`
            ]]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
            • Good day all or good night? smiley

              Really very interested in developing in MODx. I come way of WP and Drupal but I was wondering if this CMS can do something like this:

              I'm interested in adding a 'client login' to the site where a client can login and get material pertaining to them. They don't need a unique branded page but a page that has perhaps their info or just maybe a central page where they can access documents (pdfs, docs) not available to the public.

              I have built out something like this with Drupal but Drupal caching and queries were a nightmare for me. No dig on Drupal just looking for something fresh to use for the job.

              I'm not sure the direction at this point but the function would be much like a financial advisor site where the advisor can login and get pdfs not available to the public.

              Hoping someone can throw me some direction. Sorry if this in the wrong section Thanks from the newb!!!

              thanks!

              Lance
              • Certainly. When a user logs in, you can specify which page he goes to. Then it's very easy to get the user's ID and get any information about him you want to display on the page.

                See the Login package. It contains a number of interesting snippets for front-end users.
                http://rtfm.modx.com/extras/revo/login
                  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
                • Thank you very much sotwell!! One last question. Please smiley

                  If someone were to log in, they would not see any of the 'back-end' features at all. They would merely so the site as it is branded on the front-end but with either their details or a page. This can do that?

                  I've seen a few tutorials where one could prevent users from accessing resources, etc but they are really accessing the back-end cms. None of these user would be able to create content or resources. Just fill out a form.

                  thanks!@!!
                  • Thank you very much sottwell!! One last question. Please smiley

                    If someone were to log in, they would not see any of the 'back-end' features at all. They would merely see the site as it is branded on the front-end but with either their details (editing capabilties) or a page. This can do that?

                    I've seen a few tutorials where one could prevent users from accessing resources, etc but they are really accessing the back-end cms. None of these user would be able to create content or resources. Just fill out a form.

                    Edit...I see their is update profile front-end capabilities. Cool!!!

                    Many thanks!!! [ed. note: lance1572 last edited this post 5 years, 1 month ago.]
                    • That is the case. MODX works by default with two contexts, web and mgr. Again, by default, those who log in using a page with the Login snippet are only logged in to the web context.

                      See the NewsPublisher snippet for front-end editing by logged-in 'web' users. http://bobsguides.com/newspublisher-tutorial.html and http://bobsguides.com/blog.html/2013/04/28/newspublisherrestricting-users-to-their-own-pages/

                      Be aware that at this time the NewsPublisher snippet can make use of the TinyMCE rich text editor, but its connection to the File Browser for inserting images does not function in Revolution version 2.3.1
                        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