This may be more of a general SQL question, but I figured maybe one of the EE tech guys would have an answer since it deals with EE.
I’m using EE on a fairly advanced custom app and I have come across the need to generate channel entries manually. I know that URL titles need to be unique, and that whenever a new channel entry is created, you need to make sure the URL title is unique (usually by appending a number).
One approach that I’ve thought of – and that works – is to create an array of existing entries, then compare the new entry’s title to each one. If it matches an existing URL title, append a number.
However, this seems really inefficient. I doubt EE does it this way. So…how does EE generate unique URL titles? Can I use something like INSERT IGNORE? Should I make use of the Channel Entries API? (right now I’m doing it manually with PHP).
Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.