Welcome Guest, Not a member yet? Register   Sign In
Reading from database table
#1

[eluser]Altazar[/eluser]
Hi, I have a multilingual site with HMVC and it works fine, but I want to put translations in the database, instead text files. I'll leave text files translation for menu, but main content should be read from the database (for later easy updating). Database structure looks like on attached picture (should I make it different?). I'm trying all day to get it to work, but no success.

Controller:
Code:
class Italy extends MX_Controller {

public function __construct()
{
  parent::__construct();
}

public function index(){
   $this->load->view('site_header');
   $this->lang->load('menu');
   $this->load->view('menu');
   $lang_short = $this->lang->lang(); // en, de, fr...
   $this->load->model('mdl_italy');
   $data['results'] = $this->mdl_italy->get_harbour($lang_short); // ?
   $this->load->view('content_italy', $data);
   $this->load->view('site_footer');
}
Model:
Code:
class Mdl_italy extends MX_model {

function get_harbour($lang_short)  
  {  
  $query = $this->db->get_where('harbours', array('lang_short' => $lang_short));
  return $query->result();
  }
}
View:
Code:
<?php
print_r($results);
?>
I get no errors, only a completely blank page.


Messages In This Thread
Reading from database table - by El Forum - 04-08-2013, 09:25 AM
Reading from database table - by El Forum - 04-09-2013, 12:29 AM
Reading from database table - by El Forum - 04-09-2013, 01:04 AM
Reading from database table - by El Forum - 04-09-2013, 01:17 AM
Reading from database table - by El Forum - 04-09-2013, 01:27 AM
Reading from database table - by El Forum - 04-09-2013, 01:35 AM
Reading from database table - by El Forum - 04-09-2013, 03:41 AM
Reading from database table - by El Forum - 04-09-2013, 03:46 AM
Reading from database table - by El Forum - 04-20-2013, 07:36 AM
Reading from database table - by El Forum - 04-20-2013, 08:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB