Create Constants in codeigniter

Store the values in constants .You don't need to load constants anywhere, they're automatically autoloaded by itself.

create a file in config-->constants.php

we just define the variables and call them when we actually need.

defined('facebook_link') OR define('facebook_link', 'Url');

defined('twitter_link') OR define('twitter_link', 'url');

defined('youtube_link') OR define('youtube_link', 'url');

Next step:

In View page call the variables

<li>

                           <a href="<?php echo facebook_link?>" target="_blank">

                             <i class="fab fa-facebook-f"></i>

                           </a>

</li>

Sign In or Register to comment.