Welcome Guest, Not a member yet? Register   Sign In
Codeigniter + smarty problem with pass variable template to model
#1

(This post was last modified: 07-06-2015, 09:47 AM by StratoKyke.)

I explain my problem.

My model:
PHP Code:
public function info_site($name) {
        
$db $this->load->database('site'TRUE);
        
$db    ->select('name, value')
                        ->
from('arcor_site_setting')
            ->
where('name'$name);
        
$query_thread_view $db->get('');
        return 
$query_thread_view->row_array();
    } 

My controller:

PHP Code:
public function information() {
                
$this->load->model('informations');
                
$information $this->informations->info_site($name);
                
$this->smarty->assign('info'$information);
        } 

view:
Code:
{$info.site_name}

I would like the 'site_name' of view was the variable 'name' of the controller and the model. In this way the result of the variable in the template should be the value of the name.


Small example:

In my view I write
Code:
{$info.site_name}

site_name is passed to the controller and in turn the model

In this way the sql would
PHP Code:
public function info_site(site_name) {
        
$db $this->load->database('site'TRUE);
        
$db    ->select('name, value')
                        ->
from('arcor_site_setting')
            ->
where('name''site_name');
        
$query_thread_view $db->get('');
        return 
$query_thread_view->row_array();
    } 

and as a result it should give me the value of the consideration that will be printed.

There is a solution to this my problem?
Reply


Messages In This Thread
Codeigniter + smarty problem with pass variable template to model - by StratoKyke - 07-06-2015, 08:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB