Link to home
Start Free TrialLog in
Avatar of Larry Vollmer
Larry Vollmer

asked on

PHP syntax

I am having a syntax issue that I cannot figure out. Here is the code being executed:
	<?= $this->Html->link(
		$this->Html->image(
			$this->Html->url('/img/blog_widget/img.png' . " " . __("This is my html", true)),
			array(
				'alt' => __("alt text here", true),
				'target' => '_blank'
			)
		),
		$this->Html->url(
			'http://www.google.com'
		),
		array('escape' => false)
	);?>			

Open in new window


Here is the output. As you can see, the img tag is not closing and the HTML that is supposed to be echoed is included in the img reference.

<a href="http://www.google.com"><img src="/img/blog_widget/img.png This is my html" alt="alt text here" target="_blank" /></a>

Any idea why this is happening?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

It looks like an error in the code that generates the HTML  Can you please post that code?

Or maybe just change line 3 to this:

$this->Html->url('/img/blog_widget/img.png' . ">" . __("This is my html", true)),
Avatar of Larry Vollmer
Larry Vollmer

ASKER

Thanks - that spits out &gt; instead of the closing bracket.

It's cake 1.2. I will try to find a link.
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes! Thank you.