We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7527
    • 437 Posts
    distant_smile Reply #1, 16 years ago
    Hi all, another brain teaser for you if you wouldn’t mind helping.
    I am currently running a non-ajax mode search, the results return a pagetitle and an image (using the &tvphx parameter).
    It looks great and works fine, but I would like to add a 2nd tv image to the results.

    So my results would appear with a pagetitle, and 2 images underneath (one from each of my template variables). Is this possible? Any help appreciated
      www.PawsForWildlife.co.uk
      www.Borntobrick.co.uk
      • 5811
      • 1,717 Posts

      &tvPhx=`img1,img2` where img1 et img2 are your 2 Tvs.

      ==== Append the content of some Tvs to your search results with the "tvPhx" paramete
      
          &tvPhx [ [ + | - ] [ : tvlist] ] - by default ''
      
          The parameter tvPhx define which additional tv will be added as placeholder.
      
          e.g:
      
          &tvPhx=`tv1,tv2,tv3`      - tv1, tv2, Tv3 are added as placeholders
          &tvPhx=`+:tv1,tv2,tv3`    - tv1, tv2, Tv3 are added as placeholders
          &tvPhx=`+`                - all tvs of the site are added as placeholders
      
          &tvPhx=`-`                - all tvs of the site are added as placeholders
          &tvPhx=`-:tv1,tv2,tv3`    - all tvs of the site except tv1, tv2, Tv3 are added as placeholders
      
          &tvPhx=``                 - no tv defined as placeholders.
      
          The following placeholders are anabled with the tv:
      
          [+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)
              - AS_ajax_resultTvname for the ajax window (&tplAjaxResult)
      
          The tv value could be used with the filter parameter (see &filter)
      
          As withTvs includes the TV as a new field in the select clause of the mysql query,
          tvPhx append the content of the selected tv after the search and before filer.
      
      

      and
      <div>
        <a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
      <div>
      <img src="[+as.img1+]" height="[+as.img1:imgmaxheight=`120`+]" />
      <img src="[+as.img2+]" height="[+as.img2:imgmaxheight=`120`+]" />
      </div>
      [+as.extractShow:is=`1`:then=`
        <div><p>[+as.extract+]</p></div>
      `+]
      [+as.breadcrumbsShow:is=`1`:then=`
        <span>[+as.breadcrumbs+]</span>
      `+]
      </div>
      You need to adapt the template with the appropriate css tags, to place the images where you want.
        • 7527
        • 437 Posts
        distant_smile Reply #3, 16 years ago
        I have updated the results.tpl.html. And have changed my ajax call, but still only one tv image appears?
          www.PawsForWildlife.co.uk
          www.Borntobrick.co.uk
          • 5811
          • 1,717 Posts
          Could you post your AjaxSearch snippets calls and the results.tpl file.
            • 7527
            • 437 Posts
            distant_smile Reply #5, 16 years ago
            Okay Snippet call - [!AjaxSearch? &asId=`as2` &ajaxSearch=`0` &showIntro=`0` &showResults=`0` &landingPage=`79` &advSearch=`allwords`!]

            Landing page call - [!AjaxSearch? &asId=`as2` &ajaxSearch=`0` &parents=`80` &hideMenu=`0` &tvPhx=`Factfile, Factfile2` &whereSearch=`content` &order=`pagetitle` &extract=`2:longtitle,introtext`!]

            And my results.tpl is...

            <div>
            <a href="[+as.resultLink+]" title="[+as.longtitle+]">[+as.pagetitle+]</a>
            <div>
            <img src="[+as.Factfile+]" height="[+as.Factfile2:imgmaxheight=`120`+]" />
            <img src="[+as.Factfile2+]" height="[+as.Factfile:imgmaxheight=`120`+]" />
            </div>
            [+as.extractShow:is=`1`:then=`
            <div><p>[+as.extract+]</p></div>
            `+]
            [+as.breadcrumbsShow:is=`1`:then=`
            <span>[+as.breadcrumbs+]</span>
            `+]
            </div>
              www.PawsForWildlife.co.uk
              www.Borntobrick.co.uk
              • 7527
              • 437 Posts
              distant_smile Reply #6, 16 years ago
              I posted the result.tpl (not results.tpl) and have amended the image height section to match the image source (switched the factfile and factfile2 placeholders)
                www.PawsForWildlife.co.uk
                www.Borntobrick.co.uk
                • 7527
                • 437 Posts
                distant_smile Reply #7, 16 years ago
                I have cracked it! I kept &tvPhx=`tv_name,tv_name2` in my calls but I also added &withTV=`pagetitle`
                Thanks all for the handy hints here and on other forum topics, its really helped alot! smiley
                  www.PawsForWildlife.co.uk
                  www.Borntobrick.co.uk
                  • 5811
                  • 1,717 Posts
                  Except if you have a TV named pagetitle, &withTV=`pagetitle` can’t have an effect.
                    • 7527
                    • 437 Posts
                    distant_smile Reply #9, 16 years ago
                    Hi Coroico, thanks for the info. I have a slight problem. I am running two Ajax searches. The landing calls are

                    [!AjaxSearch? &hideMenu=`0` &ajaxSearch=`0` &parents=`71` &withTV=`pagetitle` &tvPhx=`Factfile, Factfile2` &order=`pagetitle` &rank=`pagetitle:100, introtext:10` &extract=`2:longtitle,introtext`!]

                    and

                    [!AjaxSearch? &asId=`as2` &hideMenu=`0` &ajaxSearch=`0` &parents=`81` &withTV=`pagetitle` &tvPhx=`Factfile,Factfile2` &order=`pagetitle` &rank=`pagetitle:100, introtext:10` &extract=`2:longtitle,introtext`!]

                    On the second call my results work and I get two images in the results. But on the first call I only get the first image (Factfile TV). The codes are identical other than the &asId=`2`, but I cannot use that in both codes. Any ideas where I am going wrong?
                      www.PawsForWildlife.co.uk
                      www.Borntobrick.co.uk
                      • 7527
                      • 437 Posts
                      distant_smile Reply #10, 16 years ago
                      Okay, its been a pain but I have fixed it for both now. Where I added the ’&tvPhx’ parameter, I added my TV name and a comma and a space and my last tv name. For example

                      &tvPhx=`Factfile, Factfile2`

                      That extra space was stopping my second Tv from appearing, I have now amended it to:

                      &tvPhx=`Factfile,Factfile2`
                        www.PawsForWildlife.co.uk
                        www.Borntobrick.co.uk