Monday, January 23, 2012

create link on image in cake php

Displaying a image in cakephp 
 
<?php echo $html->image('home.gif');?>
 
Create a link in cake php
<?php echo $html->link("Home", array('action' => 'features'),
array('escape' => false));?>
so when we talk about create a link on image we can combine both of these
echo $html->link(
    $html->image('img.png'),
    'img.png',
    array(),
    array( 'escape' => false ),     
  );
 
 
Obvious img.png is image name You have to set the path by default it goes webroot/img/
 
 
 
  • <?php echo $html->link($html->image("products.gif"), array('controller'=>'products', 'action' => 'features'), array('escape' => false));?>