Welcome Guest, Not a member yet? Register   Sign In
image link
#1

[eluser]-spy-[/eluser]
guys...using this framework..how can i make images as link..tnx
#2

[eluser]xwero[/eluser]
you mean something like below?
Code:
<a href="http://codeigniter.com/forum"><img src="http://codeigniter.com/themes/forum_themes/support/images/ci_logo.gif" alt="forum"></a>
#3

[eluser]Sawariya[/eluser]
any other option???
#4

[eluser]-spy-[/eluser]
no i mean..using the anchor..is it possible?
#5

[eluser]-spy-[/eluser]
like this

Code:
&lt;?=anchor('home','Home',array('id'=>'homenav'));?&gt;
#6

[eluser]Sawariya[/eluser]
this is only for text link not for image link....
#7

[eluser]-spy-[/eluser]
sorry about this..just a beginner in web development(OOP), tnx for the information..n_n
#8

[eluser]xwero[/eluser]
isn't
Code:
&lt;?=anchor('home','<img src="http://codeigniter.com/themes/forum_themes/support/images/ci_logo.gif" alt="forum">',array('id'=>'homenav'));?&gt;
working?
you could add a new helper function and a config item to do something like this
Code:
function img_anchor('home','ci_logo.gif',array('id'=>'homenav'),array('alt'=>'forum'));
// function
function img_anchor($uri = '', $image = '', $urlattributes = '',$imgattributes = '')
{
    
    if ( ! is_array($uri))
    {
        $site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
    }
    else
    {
        $site_url = site_url($uri);
    }
    
    if($image != '')
        {
           $ci =& get_instance();
           $image_url = $this->ci->config->item('img_url').$image;
        }

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

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

    return '<a href="'.$site_url.'"'.$urlattributes.'><img src="'.$image_url.'"'.$imgattributes.'></a>';
}
It's a quick rewrite of CIs anchor function so i don't know if it works.

But it seems a lot of parsing for something you can write in your view as
Code:
<a href="&lt;?=$url;?&gt;" &lt;?=$urlattributes;?&gt;><img src="&lt;?=$src;?&gt;" &lt;?=$imgattributes;?&gt;></a>

edit : it wouldn't work because i didn't add the image to the image url Smile it's fixed now.
#9

[eluser]Sawariya[/eluser]
yes Mr xwero
it will work.. i am using same thing ..
#10

[eluser]Unknown[/eluser]
Where is image http://codeigniter.com/themes/forum_them...i_logo.gif actually (physically) located?




Theme © iAndrew 2016 - Forum software by © MyBB