CodeIgniter - accessing $config variable in view

后端 未结 11 1078
青春惊慌失措
青春惊慌失措 2020-12-23 12:52

Pretty often I need to access $config variables in views. I know I can pass them from controller to load->view(). But it seems excessive to do i

11条回答
  •  旧巷少年郎
    2020-12-23 13:38

    This is how I did it. In config.php

    $config['HTML_TITLE'] = "SO TITLE test";
    

    In applications/view/header.php (assuming html code)

    <?=$this->config->item("HTML_TITLE");?> 
    

提交回复
热议问题