We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28163
    • 10 Posts
    Hi,
    I had built a test site a year or so ago and have recently been asked by a client to continue with it.
    It’s built on MODX version 1.0.2

    We use TVEXPLORER / TVEDITOR to filter results and display them in a CHUNK which works perfectly. The Search Form does a
    <form action="[~15~]" method="post">
    , ID 15 being the Landing Page for the results. On this Landing Page there is a large image that originally was static and did not change however the client asked if this image could change every time the search was run.

    Now we have a folder on the server holding 6 images that rotate on the Landing Page using a little bit of php in a file called rotate.php which simply changes the image every time the page is refreshed or the search is run. Again, this working great!

    Now the client has asked if the images can match the Search results. For example, if a user searches for “Personal Finance” then the results page would have a relevant image. If a user searches for “Health and Beauty” then the results page again displays a relevant image to Health and Beauty.

    I know that it’s simple to specify an image in a template or even to rotate images in the template but does anyone know how to display images relevant to search results?

    The following is placed on the landing page.

    [!tvExplorer? &dittoName=`Ditto` &dittoSnippetParameters=`tpl:dittoResultsChunk|parents:2|depth:1|display:all|sortBy:pagetitle|sortDir:ASC|showPublishedOnly:1` &formTPL=`divSearchChunk` !] [+tve.dittoList+]


    Thanks in advance for your help.

      • 10076
      • 1,024 Posts
      So would the output be a link to a page with an ID ?
      Could you then not create a TV in your template to use as tne name of your picture? [*tv_id*].jpg.

      The tv would then i guess have to contain something representing the ID of the page found? (So the one being displayed on your landing page). Must admit I have not thought this over but it s what I would try?

      So result "Personal Finance" would be eg page with ID 3, tv should resolve 3.jpg and that would display picture number 3. Really just guessing here.