• Register or
  • Sign In
    • Forgot your password?
    • Forgot your username?
    Or sign in with your account on:
    Facebook
    Twitter
    Google
    LinkedIn

K2 | The powerful content extension for Joomla! developed by JoomlaWorks

  • home
  • about
  • blog
  • documentation
  • extend K2
  • showcase
  • community
  • demo
Leverage the power of rich media publishing the easy way!
You are hereDocumentation Tips & Tricks Extra field image type as link

Extra field image type as link

19 January 2013, 11:44 by William White
in Tips & Tricks
  • Print/PDF
If you have an image type extra field and need to display a link directly to the image you must strip the default code that K2 uses to insert the image into it's foreach loop. You can insert this directly into your item.php override file.

<?php
$var = $this->item->extraFields->Image->value ;    
$var = preg_replace('/<img src="/',"",$var);
$var = preg_replace('/" alt="Image" \>/'," ",$var);
echo '<a href="' . $var . "TextOfLink" . "</a>" ;
?>

Tags:

  • extra fields ,
  • images
Tweet

Docs Tag Cloud

2009 2010 2011 advanced beginner case study checkbox checkboxlist extra fields frontend editing germany greece greek images item editing jab10 jandbeyond jd11gr joomla 15 joomla 17 joomladay k2 grup k2 kurulum k2 türkçe Ken Crowder netherlands presentation screencast tags upgrading
Download K2 for Joomla! 1.5, 2.5 & 3.x v2.6.6 (GNU/GPL) / Released April 7th, 2013
Join theK2 CommunityLooking for help with K2? Join the K2 Community Forum! Login using your Twitter or Facebook account, or your old K2 Community credentials.
K2 TranslationsK2 has already been translated into more than 50 languages. Download a Joomla! 1.5 - 2.5 compatible language pack now!
  • Contact us
  • Join the K2 Expert Companies list
  • Privacy Policy
back to top
Copyright © 2006 - 2013 JoomlaWorks Ltd.. All rights reserved. K2 is a joint project by JoomlaWorks Ltd. & Nuevvo Webware Ltd., released under the GNU/GPL v2 license.
Joomla! is a registered trademark of Open Source Matters, Inc. JoomlaWorks/Nuevvo are not affiliated with or endorsed by Open Source Matters or the Joomla! Project.
designed by Nuevvo