We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    NewsListing Version 4.2

    Minor bugfixes in relation to &datetype
      • 4095
      • 372 Posts
      Quote from: Mark at Dec 05, 2005, 09:53 PM


      Please give feedback so that this version can be perfected for release with MODx9.1


      I changed the following line to sort by publish date

      $sortdir = isset($sortdir) ? strtoupper($sortdir) : 'pub_date';
          // get sort dir


      However I now get a SQL error which seems to be realted to this (ORDER BY sc.createdon pub_date)


      « MODx Parse Error »
      MODx encountered the following error while attempting to parse the requested resource:
      « Execution of a query to the database failed - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'pub_date' at line 5 »
            SQL: SELECT DISTINCT sc.* FROM `emanz_modx`.modx_site_content sc LEFT JOIN `emanz_modx`.modx_document_groups dg on dg.document = sc.id WHERE sc.parent = '7' AND sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) ORDER BY sc.createdon pub_date; 
        [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
        Admin Sandbox Login: sandbox Password: castle
        • 18397
        • 3,250 Posts
        Standard Message: Never alter the snippet code to change a variable. Please use the corresponding parameter.

        Now, you are using the wrong variable. You need to be changing sortby (what you want to sort by) not sortdir (direction).

        So to sort by pub_date you would append
        &sortby=`pub_date`;
        

        to the snippet call.
          • 4095
          • 372 Posts
          Ops, a bad habbit I’ve gotten into back from when I knew even less about MODx, than I do now.

          Thanks for pointing out the errors of my ways, its all better now wink
            [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
            Admin Sandbox Login: sandbox Password: castle
            • 26435
            • 1,193 Posts
            Quote from: philpond at Dec 06, 2005, 03:07 AM

            Why not use CSS to add a right margin to the links instead?

            thanks. adding a .page class to my CSS with:
                 .page {
            	padding:0 5px 0 5px;
                 }
            

            worked like a charm
              Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
              All of the above... in no specific order.


              I send pointless little messages
              • 18397
              • 3,250 Posts
              NewsListing Version 4.3

              Added xhtml strict month based archives, added nl_ prefix to all styles, minor fixes and documentation cleanup.

              IF YOU ARE ALREADY USING VERSION 4.0 OR LATER YOU WILL NEED TO CHANGE YOUR STYLES TO USE THE PREFIX!
                • 4095
                • 372 Posts
                Quote from: Mark at Dec 06, 2005, 08:21 PM

                IF YOU ARE ALREADY USING VERSION 4.0 OR LATER YOU WILL NEED TO CHANGE YOUR STYLES TO USE THE PREFIX!

                There still seems to be a class ID called "pages", shouldn’t this be "nl_pages"?

                Cheers.
                  [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                  Admin Sandbox Login: sandbox Password: castle
                  • 18397
                  • 3,250 Posts
                  Where?
                    • 4095
                    • 372 Posts
                    Sorry, see attached picture from Firefox’s webdevloper.

                    I changed it originally to "nl_pages" and to adjust the styling of the pages as per Scotty’s post http://modxcms.com/forums/index.php/topic,1235.msg11973.html#msg11973 and it didn’t work. Changed it back to "pages" and it does.

                    Looking at Webdevloper, seemed to be a class ID called "pages"

                    #pages a{
                        padding:0 5px 0 5px;
                        }
                      [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                      Admin Sandbox Login: sandbox Password: castle
                      • 18397
                      • 3,250 Posts
                      Ummmm. Briggsys thats your own html surrounding the placeholders.

                      This works flawlessly for me (with no #pages div anymore):
                      <style type="text/css">
                      
                      #nl_pages {margin-top: 10px;}
                      #nl_pages #nl_currentpage {border: 1px solid blue;padding: 2px; margin: 2px; background-color: rgb(90, 132, 158); color: white;}
                      #nl_pages .nl_off {border: 1px solid #CCCCCC; padding: 2px; margin: 2px}
                      #nl_pages a {border: 1px solid rgb(203, 227, 241);; padding: 2px; margin: 2px; text-decoration: none; color: black;}
                      #nl_pages a:hover {border: 1px solid #000066; background-color: white; }
                      
                      </style>
                      <p>[!NewsListing? &tpl=`NewsListingTemplate` &startID=`2` &summarize=`3` &total=`20` &commentschunk=`FormBlogComments` &paginate=`1` &alwaysshow=`1`!]<br /><br />Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles<br />
                      <div id="nl_pages">
                      [+previous+] [+pages+] [+next+]
                      </div>