We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    I am building a website that is listing campsites and use AjaxSearch in none Ajax mode.

    Each campsite has 4 images pulled in via tv’s however what I want to achieve is when a user searches I want to show the first image (img1) in the search results so that it is floated left and the text floated right.

    Is this possible with ajaxsearch ??

    Thanks for any help.

    Paul
      • 22840
      • 1,572 Posts
      Hey all,

      Does anyone know if this is possible ??
        • 5811
        • 1,717 Posts
        on your landing page:
        [!AjaxSearch? &ajaxSearch=`0` &tplResult=`tvphxResult` &tvPhx=`tv:displayTV`!]
        and as tvphxResult chunk for instance:
         <div class="[+as.resultClass+]">
          <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
        [+as.descriptionShow:is=`1`:then=`
          <span class="[+as.descriptionClass+]">[+as.description+]</span>
        `+]
        [+as.img1Show:is=`1`:then=`
          <div class="[+as.img1Class+]"><img href="[+as.img1+]"></div>
        `+]
        [+as.extractShow:is=`1`:then=`
          <div class="[+as.extractClass+]"><p>[+as.extract+]</p></div>
        `+]
        </div>


        If img1 is the name of the Tv which contains the image file name, then you will get:

        [+as.img1+], [+as.img1Show+], [+as.img1Class+] and you need to use ajaxSearch_resultImg1 (With an uppercase letter for img1) as css class to style your image:


        ====================================================

        Placeholders for TVs are:

        [+as.tvName+], [+as.tvNameShow+], [+as.tvNameClass+]

        Where tvName is the MODx name of a TV

        [+as.tvName+] is the HTML output of your TV
        [+as.tvNameShow+] = 1 if the TV is not NULL
        [+as.tvNameClass+] :
        - ajaxSearch_resultTvName for the non ajax results (&tplResult)

        ====================================================

        Otherwise, I am interested by visiting Wales ...

          • 22840
          • 1,572 Posts
          Thanks coroico,

          I have been trying to get the &tvPhx=`tv:displayTV` to work since posting this, in the snippet it says default is 0 so I have tried adding 1 and loads of other things lol.

          Used this in the end:

          <div class="[+as.resultClass+]">
            <a class="[+as.resultLinkClass+]" href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
          <div style="width: 110px; height: 110px; float: left; margin-right: 10px;"><img style="border: 1px solid #ccc; width: 100px; height: 100px; padding: 5px;" src="[+as.img1+]" alt="[+as.pagetitle+]" /></div> 
          [+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>
          `+]
          <p style="clear: both; height: 1px;"> </p>
          </div>


          And the call:
          [!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &grabMax=`15` &extract=`1`&order=`pagetitle` &tplResult=`tvphxResult` &tvPhx=`tv:displayTV` !]


          thanks for the help grin

          Otherwise, I am interested by visiting Wales ...

          grin grin grin