CodeIgniter Forums
Anchor image using Boostrap - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Anchor image using Boostrap (/showthread.php?tid=73570)



Anchor image using Boostrap - Mekaboo - 05-09-2019

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


RE: Anchor image using Boostrap - InsiteFX - 05-10-2019

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



RE: Anchor image using Boostrap - php_rocs - 05-10-2019

@Mekab00,

Here is the documentation link: https://codeigniter.com/user_guide/helpers/url_helper.html#url-helper


RE: Anchor image using Boostrap - Mekaboo - 05-10-2019

(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


RE: Anchor image using Boostrap - Mekaboo - 05-10-2019

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

Here is the documentation link: https://codeigniter.com/user_guide/helpers/url_helper.html#url-helper

Solid, Thank You as well Heart


RE: Anchor image using Boostrap - Mekaboo - 05-10-2019

(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.


RE: Anchor image using Boostrap - Wouter60 - 05-11-2019

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.


RE: Anchor image using Boostrap - Mekaboo - 05-12-2019

(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!!