hello everyone,
when I submit a post that has a title with a (.) dot at the end, the
url created by HTMLHelper is without the (.) dot at the end, making
the link invalid...
how can I manage dots(.) at the end of urls?
example:
"localhost/johto/posts/view/The%20intersection%20....."
cakephp's HtmlHelper makes it like this:
"localhost/johto/posts/view/The%20intersection"
it's not rare for people to add dots at the end of sentences.. so I
tested it...
NOTE:
I'm still using localhost, the site is not yet uploaded.
I have my models working properly, it's just the (.) dot at the end of
urls that are sluggish.. ^_^
here's the code for the posts/view:
function view($title = array()) {
$id = $this->read_id($title);
$view_post = $this->Post->read(null, $id);
$this->set('post', $view_post);
$comments = $this->Post->Comment-
>find('all',array('conditions'=>array(
'Post.id'=>$id))
);
if($this->Post->data['Post']['published'] != 1){
$this->Session->setFlash(__('This Article is still under
moderation',true));
}
$this->set(compact('post','comments'));
$this->set('title_for_layout',$view_post['Post']['title']);
}
here's the code for the read_id(), $this->read_id($title) returns the
id where Post.title = $title:
function read_id($title = array()){
$id = $this->Post-
>find('all',array('conditions'=>array('Post.title'=>$title)
,'fields'=>array('id'),'recursive'=>0));
return $id[0]['Post']['id'];
}
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php