#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    46
    Rep Power
    2

    PHP image link (newbie)


    Hi all,

    In the red box here the "download" image and the link are rendered one after the other like this:

    PHP Code:
    <?php
    $image 
    "/download.jpg";  
    echo 
    '<img src="'.$image.'">';
    ?>

    <?php print render($items); ?>
    Can anyone please tell me can I put the link inside the image so only the image displays but it is clickable ie which in html would be

    Code:
    <a href="http://www.example.com/file.mp3"><img src="example.jpg"></a>
    Thanks
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,143
    Rep Power
    9398
    render() is apparently the thing that outputs the entire link so you'll have to modify that. If you're not sure how we'll need to see its code.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    46
    Rep Power
    2
    Originally Posted by requinix
    render() is apparently the thing that outputs the entire link so you'll have to modify that. If you're not sure how we'll need to see its code.
    OK thanks - it is Drupal 7 (render mentioned here and I am not sure where the relevant code is. If anyone knows Drupal please direct me to the relevant file or it is only a sandpit server so I could give you the SSH login

    I thought it might be general PHP territory but if it is Drupal territory then maybe I should ask on a Drupal forum.

    Thanks...

IMN logo majestic logo threadwatch logo seochat tools logo