I tried to made image with link using FormHelper..in cakephp. Below are my script:
<?php
echo $this->Html->link($this->Html->image('images/view-more-arrow.png') . ' ' . __('View More'),array('controller' => 'zones', 'action' => 'index'), array('escape' => false));
?>
Output:
<a href="/project_folder/trunk/zones"><img src="/project_folder/trunk/img/images/view-more-arrow.png" alt=""> View More</a>
Expect:
<a href="/project_folder/trunk/zones"><img src="/project_folder/trunk/images/view-more-arrow.png" alt=""> View More</a>
My image directory path is project_folder/app/webroot/images. I don't know why its take img/ automatic.
Thank you in Advance..
I refereed this link: Cakephp html link with image + text, without using css
You can use the slash at the beginning of the path because is relative to the app/webroot directory:
echo $this->Html->link($this->Html->image('/images/view-more-arrow.png') . ' ' . __('View More'),array('controller' => 'zones', 'action' => 'index'), array('escape' => false));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With