We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    I have mentionned this a few times on the forums, but I plan to build an AJAX enhanced template for MODx as a "showcase" template (that is, when I am done learning the thing).

    Banzai has already started with PortalX, which gives us a first glance at what could be done with this.

    I’ll have a closer look at the Bloxpress wordpress template for inspiration, do you know of other examples that could help me start ?

    As I am beginning to read the script.aculo.us documentation, I was wondering how many of you are doing the same ? Does anyone aside from Banzai and myself plan to build an AJAX enhanced template ?

    Thanks for your ideas and input !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 2762
      • 1,198 Posts
      Hi David wink I’m working on a new Ajax template - you want to help me to resolve some bugs?
        Free MODx Graphic resources and Templates www.tattoocms.it
        -----------------------------------------------------

        MODx IT  www.modx.it
        -----------------------------------------------------

        bubuna.com - Web & Multimedia Design
        • 25663 MODX Staff
        • 12,272 Posts
        When you say an AJAX template do you mean one which changes page content without reloading, or one with some DHTML effects?
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 2762
          • 1,198 Posts
          Now i’m working only on Dhtml effects template. rolleyes

          I will create a template with effects like Bloxpress, but with a Newslisting Display Chunk that works like this http://www.backbase.com/demos/travel/.

          Ryan do you know how to identify ’only one’ summary div???

          Now i’m using a chunk like this:
          <div>
          <div align="left"></div>
          <h3 align="left"><a id="closebutton" onclick="Effect.SlideUp('textsummary')"><img src="assets/templates/MODajax1/imgs/up.gif" alt="close" width="14" height="14" /></a> <a id="expandbutton" onclick="Effect.SlideDown('textsummary')"><img src="assets/templates/MODajax1/imgs/down.gif" alt="expand" width="14" height="14" /></a>[+title+]</h3>
          <div id="textsummary">[+summary+]</div>
          <div style="text-align: right;">
          <p>[+link+]</p>
          </div>
          <hr /> </div>
          


          test template is here http://www.tattoocms.it/test/modajax1.html

            Free MODx Graphic resources and Templates www.tattoocms.it
            -----------------------------------------------------

            MODx IT  www.modx.it
            -----------------------------------------------------

            bubuna.com - Web & Multimedia Design
            • 25663 MODX Staff
            • 12,272 Posts
            IDs must be unique on each page.

            You’d need to auto-generate a unique ID for each instance on a page, assign it to the relevant element to which you’re trying to apply the effect, and then attach the effect to that ID. Not trivial, but entirely doable I’d think.

            I’d love to see your template store user settings in a cookie ... that’d be really cool. smiley
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 2762
              • 1,198 Posts
              I will create a newslisting chunk that shows and hide summary , leaving title visible.
                Free MODx Graphic resources and Templates www.tattoocms.it
                -----------------------------------------------------

                MODx IT  www.modx.it
                -----------------------------------------------------

                bubuna.com - Web & Multimedia Design
                • 2762
                • 1,198 Posts
                Thanks a lot Ryan - How can i auto generate an ID?
                  Free MODx Graphic resources and Templates www.tattoocms.it
                  -----------------------------------------------------

                  MODx IT  www.modx.it
                  -----------------------------------------------------

                  bubuna.com - Web & Multimedia Design
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Uhh... via some custom snippet code I’d guess. sad

                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Quote from: rthrash at Jan 27, 2006, 07:04 AM

                    IDs must be unique on each page.

                    You’d need to auto-generate a unique ID for each instance on a page, assign it to the relevant element to which you’re trying to apply the effect, and then attach the effect to that ID. Not trivial, but entirely doable I’d think.

                    The old Etomite FAQ snippet does it; it uses the document ID as the faq ID:

                    //[[FAQ?faqFolder=foldernumber]]
                    //Replace foldernumber with the id of the folder
                    //Page title is displayed as the question and content is the answer.
                    //The question is in a CSS class "faq" 
                    
                    $resourceparent = isset($faqFolder) ? $faqFolder : $modx->documentIdentifier;
                    $output = "<script type="text/javascript">
                    function expand(thistag) {
                       styleObj = document.getElementById(thistag).style;
                       if (styleObj.display=='none') {styleObj.display = '';}
                       else {styleObj.display = 'none';}
                    }
                    </script>";
                    
                    
                    $faq = $modx->getActiveChildren($faqFolder,'pagetitle', 'ASC', $fields=' id, pagetitle, content');
                    $limit=count($faq);
                    if($limit<1) { 
                       $output .= 'No Questions Found<br />'; 
                    } 
                    for ($y = 0; $y < $limit; $y++) {
                    $output .= '<div onclick="expand(''.$faq[$y]['id'].'');" style="cursor:pointer;"><div class="faq">'.$faq[$y]['pagetitle'].'</div><div id="'.$faq[$y]['id'].'"  style="display:none">'.$faq[$y]['content'].'</div></div><br />';
                    }
                    
                    return $output;
                      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
                      • 18397
                      • 3,250 Posts
                      Or you could just do this in the NewsListing template

                      <div id="newsitem_[+id+]"></div>