I am using a lightweight CMS that has the option to repeat regions. In order for the region to be repeatable, it must have an id. When the region is repeated so is the id. This causes my code to invalidate.
I was hoping there was a way to change all matching id's (example) to (example-1), (example-2), etc... so that it would validate. I was able to do this through JQuery, but it still did not validate (I am assuming because Javascript i开发者_如何学Gos client side), which is why I though PHP might work.
Thank you for your time, Andre
It won't validate through the W3C validator because it just processes the HTML.
Why don't you change them, and you can't do it manually, use DOMDocument (or equivalent).
- Iterate through the elements with
id
that isn't unique. - Tack on a number.
- Save back.
精彩评论