Can anyone tell me how I can add a custom counter to each result item without an ordered list?
What I have is a add to favourites but some names have a identical data-id but if I add a counter teach then I get a unique number.
I have this at the top of my search page <#assign count = 0>
This is what I’m trying to do <a href="# "data-courseid="${s.result.metaData["A"]!?replace("|", ", ")}_ <#assign count = count + 1>"
this throws an error - completely breaks the page so can someone show me how this is done?
Thanks Ian, I’ve just been given the task of looking after search so I’m a tad rusty plus I updated my question to show the code. Can you give me an example code or point me to the help section on how to use the rank?
Otherwise your original code wasn’t too far off, but instead of just assigning a new value to the count, you’d also need to print the value where you want it:
Hey Ian, using your options definitely worked so thank you. I am interested however to get my almost original code to work as well however using this still breaks the page, any ideas?
It may have been because of the results is a seperate “results.ftl” i.e using <#import "results.ftl" as Result/>
So when I moved the assign code to the results I didn’t get an error but I now am getting a number but its not incrementing - they’re all just have a _1 data-courseid="HLB102_1" etc