We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    Is it possible to set a alternating template or a alternating class (even better!) on the resultstemplate?

    I have a site that needs a alternating background color for every 2nd resultitem.
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 5811
      • 1,717 Posts
      In your result template (result.tpl.html)replace
      <div class="[+as.resultClass+]">
      by
      <div class="[+as.resultClass+] alt[+as.resultNumber:math=`?%2`+]">
      And then define the two classes alt0 and alt1.

      [+as.resultNumber+] provides the number of the result.

      Same thing for ajax mode with the ajaxResult.tpl.html template.

      Phx is not required. The ajaxSearch parser take into account natively the math modifier (and some others. Look at classes/asPhxParser for more details).

      See How to alternate results and the custom output demo
        • 25483
        • 741 Posts
        thank you coroico, that is what I was looking for smiley
          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media