doctrinesymfony-1.4link-to-function

Symfony image button for link_to function


I have a form that when originally submitted, it goes into a page where a user can "preview" the item before posting it to the site. I have these 3 links, but I would like to change it from the default text links to image buttons that they can click on to perform these tasks.

  <?php echo link_to('Edit', 'ticket_edit', $ticket) ?>
  <?php echo link_to('Purchase', 'ticket_publish', $ticket, array('method' => 'put')) ?>
  <?php echo link_to("Cancel", 'ticket_delete', $ticket, array('method' => 'delete', 'confirm' => 'Are you sure you want to delete the item?')) ?>

So instead of "edit", "publish", and "cancel", I want it to display an image for each.


Solution

  • You can use

    <?php echo link_to( image_tag( '<your image name>' ), 'ticket_edit', $ticket) ?>
    

    and so on for the other links...