CI program to display telugu2english

I have decided to try posting CI programs that I have started on as I feel this may help others.

I started on a program to do part of Working Prototype v1.0

The program trips up on displaying Telugu characters of column telugu (unicode collation) and shows junk. It shows other columns with English text properly. English text in telugu column is also shown correctly. Problem is only with telugu characters.

I was able to add the telugu character words to telugu column of telugu2english table using phpmyadmin as follows:

a) Use http://telugu.changathi.com/ to type in English (e.g. meeru) to get Telugu (e.g. మీరు) characters.

b) Copy paste Telugu character sentence/word from changati window into telugu column in phpmyadmin insert page.

That’s it. On clicking Go, phpmyadmin adds the data correctly. Browsing the table in phpmyadmin shows telugu characters correctly.

Plan to study html source of phpmyadmin page which shows telugu characters correctly to get some clues about fixing my CI program problem.

Here are the CI programs source code (could not figure out a way to preserve tabs in the listing):

The controller: t2e.php
<?php

class t2e extends CI_Controller {

function index() {

$this->load->model('t2e_model');

$data = array();

$data['t2e'] = $this->t2e_model->getdata();
$this->load->view('t2e_view', $data);
}

}
?>

The model: t2e_model.php

<?php

class t2e_model extends CI_Model {

function getdata() {
$query = $this->db->get('telugu2english');
$data = array();

foreach ($query->result() as $row) {
$data[] = array(
'telugu' => $row->telugu,
'english' => $row->english,
'english_audio_path' => $row->english_audio_path
);
}

return $data;
}

}
?>

The view: t2e_view.php

<?php $this->load->helper('form'); ?>

<?php echo form_open('t2e'); ?>
<?php if (isset($t2e)): foreach ($t2e as $p): ?>

<?php echo $p['telugu']; ?> <br>

<?php echo $p['english']; ?> <br>

<?php echo $p['english_audio_path']; ?> <br>

<?php endforeach; else: ?>

<h2>No data found</h2>

<?php endif; ?>
<?php echo form_close(); ?>
Advertisements
This entry was posted in Spoken English App. Blog. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s