Welcome Guest, Not a member yet? Register   Sign In
Anchor image using Boostrap
#1

Hey all!

Through this forum Ive become comfortable with anchors and functions (THANK YOU Blush ) but only with linking text. How do you link an image. I want to use this:


Code:
<a class="navbar-brand" href="#">
   <img src="/docs/4.3/assets/brand/bootstrap-solid.svg" width="30" height="30" alt="">

Heart Heart ,
Mekaboo
Reply
#2

Code:
<img src="<?= base_url('/docs/4.3/assets/brand/bootstrap-solid.svg');?>" width="30" height="30" alt=""
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

@Mekab00,

Here is the documentation link: https://codeigniter.com/user_guide/helpe...url-helper
Reply
#4

(05-10-2019, 03:23 AM)InsiteFX Wrote:
Code:
<img src="<?= base_url('/docs/4.3/assets/brand/bootstrap-solid.svg');?>" width="30" height="30" alt=""

Solid, Thank You Heart
Reply
#5

(05-10-2019, 06:34 AM)php_rocs Wrote: @Mekab00,

Here is the documentation link: https://codeigniter.com/user_guide/helpe...url-helper

Solid, Thank You as well Heart
Reply
#6

(05-10-2019, 03:23 AM)InsiteFX Wrote:
Code:
<img src="<?= base_url('/docs/4.3/assets/brand/bootstrap-solid.svg');?>" width="30" height="30" alt=""
I treid what you gave me and its not working. Im trying to link image with controller/function like this but instead of button it will be an image. I at URL helper info and it seems as if it only links to text not image.
Reply
#7

(This post was last modified: 05-11-2019, 05:20 AM by Wouter60.)

The anchor() function takes 3 arguments.
1. URI string
2. Title
3. Options (optional)

The second argument (title) can be a simple text like 'Click here', but it can also be an image or any other html element.
PHP Code:
$image '<img src="' base_url('assets/images/example.png') . '" width="30" height="30" alt="" />';
echo 
anchor('users/login'$image); 

In this example, the result is an image (example.png) that is clickable, like a normal hyperlink. The link points to the login function in the users controller.
Reply
#8

(05-11-2019, 05:18 AM)Wouter60 Wrote: The anchor() function takes 3 arguments.
1. URI string
2. Title
3. Options (optional)

The second argument (title) can be a simple text like 'Click here', but it can also be an image or any other html element.
PHP Code:
$image '<img src="' base_url('assets/images/example.png') . '" width="30" height="30" alt="" />';
echo 
anchor('users/login'$image); 

In this example, the result is an image (example.png) that is clickable, like a normal hyperlink. The link points to the login function in the users controller.

Thank you so very much Heart  I got the img src part but I couldnt link it. Thanks for the help!!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB