php - how to get site title from database in Main Layout view in codeingiter -
i have created script allows admin set site title , site email cms, gets stored in database.
i views folder have _main_layout.php file basic layout of webiste, want fetch site title database in main_layout in nav bar.
below code want title:
<body> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="<?php echo site_url('admin/dashboard'); ?>"><?php echo $meta_title; ?></a> </div> the meta title here fetched statically want instead site_title fetched dynamically database.
so admin of cms can set site title.
dont worry ever u r setting ur title not issue solution have title in database go application/helper/ create helper file functions_helper.php add in autoload like
$autoload['helper'] = array('url','functions'); in helper file creat function like
function get_site_title() { $ci =& get_instance(); $ci->load->model("your_model"); return $result = $ci->your_model->getsitetitle(); } then call function anyfile in project either controller/model or view get_site_title() , thats it
Comments
Post a Comment