I have a string of piped category ID's which represent all the categories which are selected for any given page.
Within my page, I now need to check the input of the chosen categories.
For example, I have {segment_category_ids_piped}
(I'm using Low Seg2Cat) - this returns "3|5|6|14"
.
In my category loop, I now need to check the checkbox if the category exists. The code I have at the moment is :
<li><input type="checkbox" {if segment_category_ids_piped *= cat_id}checked="checked"{/if}><a href="#" title="{cat_name}">{cat_name}<span>({entry_count})</span></a></li>
The problem is that it's treated as a literal string, so if I loop through my categories, it's showing cat_id 1 and 4 as being selected, because they are represented in the string for 14.
I'm presuming that a regular expression would be needed here, but I'm at a bit of a loss as to the syntax (RegExp has never been a strong point of mine!).
Thanks