I think your modulo isnt correct but this solution is what i need. Thanks. Should be index%mod==0 i think. But anyway... thats why i hate templateengines. Is it possible to use php files as templates anyway?