Welcome Guest, Not a member yet? Register   Sign In
Site Name Function
#1

[eluser]lszanto[/eluser]
I know this is a simple function but I just thought it could be useful for people to have a global site name e.g My Site and just to add on a string e.g - Home so when calling the function site_name() you can retrieve My Site - Home. The code to add this is below and the url helper is required.

Insert Into /system/applaction/config/config.php
Code:
/*
|--------------------------------------------------------------------------
| Site Name
|--------------------------------------------------------------------------
|
| The full name of your website to implement in your pages.
|
|    My Site
|
*/
$config['site_name'] = "My Site";

Obviously replace the site name with your own site name.

And Insert this into /system/helpers/url_helper.php
Code:
// ------------------------------------------------------------------------

/**
* Site Name
*
* Returns the "site_name" item from your config file
*
* @access    public
* @return    string
*/    
function site_name()
{
    $CI =& get_instance();
    return $CI->config->item('site_name');
}


Hopefully this has helped and is useful to you if not sorry for wasting your time Smile
#2

[eluser]Derek Allard[/eluser]
No, this is great. In fact, CI supports the creation of custom config files if you need it, and I use this on nearly every project.

Config in the userguide




Theme © iAndrew 2016 - Forum software by © MyBB