Saturday, August 27, 2011

Re: HTML ENTITIES

On Aug 27, 2011, at 03:46, Prabha vathi wrote:

> echo $html->link(
> Sanitize::html($post_array['content'], array('remove' => true)),
> array(
> 'controller' => 'posts',
> 'action' => 'view',
> 'id' => $post_array['id'],
> 'quotes' => $this->Link->makeSeoUrl(Sanitize::html($post_array['content'], array('remove' => true)))
> ),
> array('title' => substr(Sanitize::html($post_array['content'], array('remove' => true)),0,20)." ... Quotes of the day", 'class' => 'agrizlink')
> );
>
> Now db has text like this - you're - but it is displayed like this - you're in view.
> But if there is no link, then it is working correctly. What is the problem?

Sanitize::html is escaping it once. Then $html->link is escaping it a second time.

Tell $html->link not to escape it that second time by passing false in the $escapeTitle parameter.

http://book.cakephp.org/view/1363/link

Note, by the way, that "$html" is old CakePHP 1.2 syntax. For CakePHP 1.3, you want to use "$this->Html" instead.


--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: