CakePHP: How can redirect to a new web page with html anchor <a>... </a>?
The comment form =>
echo $this->Form->create('Comment',array('url'=>array('controller' => 'comments', 'action' =>'add', $listposts['Post']['id']) ) );
echo $this->Form->input('post_id',array('type'=>'hidden','style'=>'width:30%','value'=>$listposts['Post']['id']));
echo $this->Form->input('name',array('style'=>'width:30%'));
echo $this->Form->input('email',array('style'=>'wid开发者_运维技巧th:30%'));
echo $this->Form->input('body',array('rows'=>'5'));
echo $this->Form->end('Comment');
In the body field of the comment form if i type like this =>
<a href="www.google.com"> google </a>
I get a link "google" in that web page but if i click that link it doesn't redirect to www.google.com. Why doesn't redirect ?
If i hover that link i see =>
http://www.mysite.com/posts/view/www.google.com
How can i redirect to www.google.com clicking that link ?
You need to make the url "http://www.google.com". Because there's no protocol specifier it interprets the href field as a relative link instead of a link to another domain.
You can use html help of Cakephp:
<?php echo $this->Html->link('google', 'http://www.google.com'); ?>
精彩评论