I am using split to generate a series of class in my templete.
The problem is with a tag consisting of more than one word.
one word tag: red, blue, yellow, ecc.
two words tag: light blue, warm gray, ecc.
To solve tihs problem I try to use escape() but doesn’t work with split I think.
My goal is: “light blue” become “lightblue” or “light-blue” automatically
Please note that $tag is not a field object, but just a string (the split methods returns an array), so using escape() here will throw an error anyway.
My tags with two words produce a url with a space in between, which logically does not work well.
The effect is, that the tags with two words will appear in the tag cloud, but when i click them, they will show any projects with these tags.
I tried to implement your solution, everywhere i could think of, but it always trows an error.
Here is every peace of code that is doing something with the my tags:
@texnixe Oh. Yes, when i downloaded the Photographer portfolio, it is kirby 3, right? Sry. I will look for another post… It seems like the same problem.
I’ve got a similar problem in my server with a kirby 2 installation. I’ve got tags with empty spaces and accents (spanish language) and the code above works perfect for changing empty spaces to + signs, but keep the accents, and the server doesn’t work well with accents when you visit the page of the tag, it gives an error caused by html encoding. Is there any way to clean accents from the tag urls?