I want add category depends if it return true or false.
Lets say i have | name = a,b,c,d,e
if it contain a , add category a
I want add category depends if it return true or false.
Lets say i have | name = a,b,c,d,e
if it contain a , add category a
I just stumbled upon a parser function that will let you do this: #pos
If it finds no match, it returns an empty string, which is enough to test your yes/no condition:
## where {{{var}}} = "word,apple,tree" ## {{#if:{{#pos:{{{var|}}}|word}}|[[Category:Word]]|}} ## Category Word added ## {{#if:{{#pos:{{{var|}}}|toy}}|[[Category:Toy]]|}} ## Category Toy not added ##
If you're doing this a lot, consider using Lua