I have been trying to do the following method to create urls like:
domain.com/portfolio/This_is_a_test_post
function view ( $title )
{
It does not work because you are applying the Inflector::slug function to the name of the column.. Try the other way around.., add a slug column to your post, and create the slug when you add the post using the Inflector, try something like this when you add your post:
$this->data['Post']['slug'] = Inflector::slug($this->data['Post']['title']);
and on your controller, do this:
function view($slug = null) {
if (is_null($slug)) {
$this->cakeError('error404');
} else {
$post = $this->Post->findBySlug($slug);
$this->set(compact('post'));
}
}
that should do the trick.. i hope it helps..