We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26027
    • 145 Posts
    I'm glad we're on the right track now, Susan. I do have questions on the implementation, however.

    1. I want to display the pagetitle linked to the page, and also the usual snippet of text from the "content".

    2. Why did you use the result.tpl.html instead of results.tpl.html and not both?

    3. It seems easiest to leave the config file pointing to the default file, but I would first comment out the statements I don't want. Yes?

    4. Looking at the syntax of the html file, it seems to me that all I would remove is:
    [+as.descriptionShow:is=`1`:then=`
    <span class="[+as.descriptionClass+]">[+as.description+]</span>
    `+]


    Is that 100% correct?

    5. I do not understand your final remark at all, Susan:
    Looking at this tpl, it appears that there should be properties to indicate whether or not the description, extract, and breadcrumb should be displayed in the default template. Only the &breadcrumbs property seems to actually exist, however.

    Can you please explain your concern there? Talk to me like I'm in kindergarten, especially when you say "Only the &breadcrumb properties seem to exist".

    If I'm really understanding this, I should be close to a solution by simply doing Step 4 above.

    How in the world, Susan, is a newbie with MODx supposed to understand how all these disparate code files, templates, and configuration files are supposed to coordinate with each other in order to work properly?

    Comments?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      1. That is why AjaxSearch, as well as all properly-designed snippets such as Wayfinder and Ditto, have customizable tpls. It makes MODx all that much more flexible.

      2. resultsTpl handles the display of everything surrounding the actual list of results. That is where your "no results" text is, and where group titles and x results shown of xyz is. resultTpl is for each individual result.

      3. Editing the default tpl is a bad idea. If you upgrade, that will overwrite your edited version of the default tpl. Plus if you really mess it up, you'll have a hard time getting it back to its original state. It's always better to use your own tpl; it only takes a few minutes to create a chunk, copy/paste the default tpl into the new chunk, then edit that new chunk.

      4. That is correct.

      5. In that default tpl, there are three conditional blocks, one for showing the description "if as.descriptionShow is 1", likewise one for showing the extract and one for showing a breadcrumb trail. Now, there is a property &breadcrumbs, which can be set to 1 or 0 in the snippet call, which if set to 0 will cause that conditional block in the tpl to not display a trail (AjaxSearch converts that property key to as.breadcrumbsShow internally). There should be corresponding properties for &description and &extract, but I haven't been able to find any reference to them. It might be interesting to leave the tpl alone and see what happens if you put &description=`0` in the snippet call.

      A newbie is supposed to learn, then he, too, can become an old experienced MODx user wink That's what these forums are for.
        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
        • 26027
        • 145 Posts
        I'm jumping the gun on you Susan. While awaiting your reply, I modified the default result.tpl.html file, ignored the results.tpl.html file, ignored all the other things I didn't understand, and everything worked like a charm.

        Here's my result.tpl.html file:
        <div class="[+as.resultClass+]">
          <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
        <!-- removed by Sam Gerber to avoid including descriptions in the results
        [+as.descriptionShow:is=`1`:then=`
          <span class="[+as.descriptionClass+]">[+as.description+]</span>
        `+]
        -->
        [+as.extractShow:is=`1`:then=`
          <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
        `+]
        [+as.breadcrumbsShow:is=`1`:then=`
          <span class="[+as.breadcrumbsClass+]">[+as.breadcrumbs+]</span>
        `+]
        </div>
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That's all there is to it.

          Keep in mind that HTML comments don't prevent MODx from processing its own tags; if you look at a View Source of the search results page you'll see that the description is actually in the source, just not displayed by the browser because of the HTML comment tags.
            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
            • 26027
            • 145 Posts
            Susan, I tried passing the parameter &description=`0` and it was ignored. I'm sure that doesn't shock you.
            Keep in mind that HTML comments don't prevent MODx from processing its own tags; if you look at a View Source of the search
            results page you'll see that the description is actually in the
            source, just not displayed by the browser because of the HTML comment
            tags.
            Very good Susan. I had noticed that also and was a bit surprised.

            BTW, your comment about losing my changes after an update is well taken.

            A newbie is supposed to learn, then he, too, can become an old experienced MODx user wink That's what these forums are for.

            Silly me. I thought that was what good documentation was for. Well, in lieu of that, the forums are an excellent second.

            Well, I can hardly stand all this excitement and am happy this is finally working the way I wanted. I learned a lot doing it.

            Let me thank you very much for being so attentive to my problem and so helpful. You're a rare breed.

            Best regards ... Sam
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Sometimes documentation needs interpretation. I can remember reading my first programming magazines more than 20 years ago and being totally confused; it was if they were speaking a different language. Baffling.

              You might find this useful; it is the distillation of at least six years of my experience working with Evolution, kindly hosted by pogwatch.com - in itself an excellent source of Evo goodness, especially Ditto. http://sottwell.pogwatch.com/

              Mary's Coding Pad has good Evo stuff, and Muddy Dog Paws is for Wayfinder, as evo.wangba.fr is for things AjaxSearch. [ed. note: sottwell last edited this post 13 years, 9 months ago.]
                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
                • 26027
                • 145 Posts
                Thanks Susan. I've stored your 4 recommended bookmarks.

                I didn't mention this but I've been a web designer for many years but never installed MODx. The MODx developer who installed at my primary client was not retained to provide maintenance. That was assigned to me.

                Largely through support at these forums, along with considerable study of the installed system and its objects and factoring in some intuition, I've been reasonably successful in making needed mods to their system.

                Your assistance has stood out, two or three times now.

                Best ... Sam