2010-12-01 10 views
4

Ich habe diesen Code-Block in einer cakephp .ctp Datei:

<h1> 
    <?php echo $this->Html->link('Hello <span>Stack Overflow</span>', 
     array('controller'=>'pages', 'action'=>'home')); ?> 
</h1> 

Aber statt der HTML formatiert, ich sehe es wörtlich:

<h1><a href="/rrweb/www/hub/pages/home"> 
Hello &lt;span&gt;Stack Overflow&lt;/span&gt;</a></h1> 

Jede Idee?

Danke!

Antwort

23

Sie müssen disable HTML entity conversion:

echo $this->Html->link(
    'Hello <span>Stack Overflow</span>', 
    array('controller'=>'pages', 'action'=>'home'), 
    array('escape' => FALSE) 
); 
+0

allright! Danke :) –

+1

* diese plötzliche Erkenntnis, ein Idiot zu sein * Danke! – Karma

1

oder

echo $this->Html->link('Hello', array('controller'=>'pages', 'action'=>'home')).' '.$this->Html->tag('span', $this->Html->link('Stack Overflow', array('controller'=>'pages', 'action'=>'home')), array());