![]() |
Slugs - Help me to understand - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Slugs - Help me to understand (/showthread.php?tid=49063) |
Slugs - Help me to understand - El Forum - 02-07-2012 [eluser]Mauricio de Abreu Antunes[/eluser] Hello, i'm trying to understand slugs. http://ericlbarnes.com/post/13129707173/codeigniter-slug-library This post tells me to insert my new with a slug like 'help-me-with-slugs'. Ok, i understood this part. I can not understand how i can select data from a slug? Code: select * from news where slug = 'help-me-with-slugs'; Btw, Code: ...where slug = 'help-me-with-slugs' Performing a query with no primary key like http://www.site.com/news/24/help-me-with-slugs where 24 is 'help-me-with-slugs' ID. And what about routes if i get 'help-me-with-slugs' pagination? Thanks! Slugs - Help me to understand - El Forum - 02-07-2012 [eluser]InsiteFX[/eluser] Post your question in the correct forum topic and you may get help! This forum topic is for donate user code... Slugs - Help me to understand - El Forum - 02-09-2012 [eluser]Phil Sturgeon[/eluser] A slug is simply a unique identifier that means more to a user than 459372 does. It also protects people from mining your data by incrementing a number in a URL and saving all your stuff, or being able to work out how many sales you are making a'la the ridiculous way Magento handle their sales. You should be making your slugs unique, by either saying "this title is already taken" or by adding -2 to the end of the slug if you've found a match in the db. Also make the field into an index key or your database will get SLOW. |