Welcome Guest, Not a member yet? Register   Sign In
Text with images
#1

[eluser]Unknown[/eluser]
Anybody Help me
i want to pass text + images in anchor tag.
#2

[eluser]gRoberts[/eluser]
simply use an anchor tag...

Code:
<a href="&lt;?= site_url('controller/action/param'); ?&gt;">Some text <img src="&lt;?= base_url(); ?&gt;assets/images/an-image.jpg" alt="An image" title="This is an image" /></a>
#3

[eluser]weboap[/eluser]

http://ellislab.com/forums/viewthread/97297/
#4

[eluser]InsiteFX[/eluser]
SaveAs: ./application/helpers/MY_url_helper.php
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* Created with Php Designer 8.
* Created by: The Learn CodeIgniter Development Team.
* User: Raymond King Sr. aka: (InsiteFX)
* Date: 1/19/2012
* Time: 6:43:31 PM
* @copyright 1/19/2012 by Raymond L King.
*
* Class name: ./application/helpers/MY_url_helper.php
*
* To change this template use File | Settings | File Templates.
*/

// ------------------------------------------------------------------------

/**
* Anchor Image Link
*
* Creates an image anchor based on the local URL.
*
* Usage:
*
* Controller:
* $data['img'] = base_url().'assets/images/gravatar.jpg';
*
* View:
* &lt;?php $img =  base_url('assets/images/gravatar.jpg'); ?&gt;
*
* &lt;?php echo anchor_img('index.php/welcome', 'Image Test', $attr, $img); ?&gt;
*
* @access public
* @param string the URL
* @param string the link title
* @param mixed any attributes
* @param string the image source path
* @return string
*/
if ( ! function_exists('anchor_img'))
{
function anchor_img($uri = '', $title = '', $attributes = '', $img_src = '')
{
  $title = (string) $title;

  if ( ! is_array($uri))
  {
   $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
  }
  else
  {
   $site_url = site_url($uri);
  }

  if ($title == '')
  {
   $title = $site_url;
  }

  if ($attributes != '')
  {
   $attributes = _parse_attributes($attributes);
  }

  $out = '';

  if ($img_src == '')
  {
   $out = '<a href="'.$site_url.'">'.$title.'</a>';
  }
  else
  {
   $out  = '<a href="'.$site_url.'">'.'<img src="'.$img_src.'"></a>';
   $out .= '<a href="'.$site_url.'">'.$title.'</a>';
  }

  return $out;
}
}

/* ------------------------------------------------------------------------
* End of file MY_url_helper.php
* Location: ./application/helpers/MY_url_helper.php
* ------------------------------------------------------------------------
*/




Theme © iAndrew 2016 - Forum software by © MyBB