Graham I liked your tutorial, and I've come up with a little addition
for it.
An excerpt for my work in progress site:
function view ($entry=NULL)
{
$item = $this->News->findBySlug($entry);
if(!empty($item)) {
$this->set('news', $item);
}
elseif ($this->News->find("id = $entry")!=NULL) {
$this->set('news', $this->News->find("id = $entry"));
} else { $this->flash('That\'s not a valid news entry.<br />No
such
id or slug exists.', '/news'); }
}
I'm sure you understand the code (and I doubt it's the best way to do
it), but I thought it'd be neat to have both id and slug links. It may
be a little redundant, but not everything can have a slug. Also, if a
user bookmarked the page with the id, say before you switched to slugs
or before the particular page had a slug, their link will still work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---