Cakephp 1.3, Weird behavior on firefox when using $this->Html->link ...

Posted by ion on Stack Overflow See other posts from Stack Overflow or by ion
Published on 2010-05-05T15:56:42Z Indexed on 2010/05/05 15:58 UTC
Read the original article Hit count: 181

Filed under:
|

Greetings,

I am getting a very weird and unpredictable result in firefox when using the following syntax:

$this->Html->link($this->Html->div('p-cpt',$project['Project']['name']) . $this->Html->div('p-img',$this->Html->image('/img/projects/'.$project['Project']['slug'].'/project.thumb.jpg', array('alt'=>$project['Project']['name'],'width'=>100,'height'=>380))),array('controller' => 'projects', 'action' => 'view', $project['Project']['slug']),array('title' => $project['Project']['name'], 'escape' => false),false);

OK I know it is big but bear with me.

The point is to get the following output:

<a href="x" title="x">
<div class="p-ctp">Name</div>
<div class="p-img"><img src="z width="y" height="a" alt="d" /></div>
</a>

I'm not sure if this validates correctly both on cakephp and html but it works everywhere else apart from firefox. You can actually see the result here: http://www.gnomonconstructions.com/projects/browser To reproduce the result use the form with different categories and press search. At some point it will happen!!

Although most of the time it renders the way it should, sometimes it produces an invalid output like that:

<a href="x" title="x"></a>
<div class="p-cpt">
<a href="x" title="x">name</a>
</div>
<div class="p-img">
<a href="x" title="x"><img src="x" width="x" height="x" alt="x" /></a>
</div>

Looks like it repeats the link inside each element.

To be honest the only reason I used this syntax was because cakephp encourages it.

Any help will be much appreciated :)

© Stack Overflow or respective owner

Related posts about cakephp

Related posts about firefox