Sunday, 15 February 2015

php - Using Language Class in Controller (CodeIgniter) -



php - Using Language Class in Controller (CodeIgniter) -

first of all, made research couldn't find it.

i'm sending flash info users when update or add together something. controller file's related part this;

function hizmet_ekle() { if($this->mhizmetler->hizmet_ekle()) { $this->session->set_flashdata('ok', 'hizmet sisteme eklendi!'); redirect('panel/hizmetler'); } else { $this->session->set_flashdata('hata', 'bir hata oluştu. lütfen tekrar deneyin!'); redirect('panel/hizmetler'); } }

and view's related parts this;

<?php if($this->session->flashdata('ok')): ?> <div class="alert alert-success fade in widget-inner"> <button type="button" class="close" data-dismiss="alert">×</button> <i class="fa fa-check"></i> <?php echo $this->session->flashdata('ok');?> </div> <?php endif; if($this->session->flashdata('hata')): ?> <div class="alert alert-danger fade in widget-inner"> <button type="button" class="close" data-dismiss="alert">×</button> <i class="fa fa-times"></i> <?php echo $this->session->flashdata('hata');?> </div> <?php endif; echo validation_errors(' <div class="alert alert-danger fade in widget-inner"> <button type="button" class="close" data-dismiss="alert">×</button> <i class="fa fa-times"></i> ', ' </div>'); ?>

my scheme has few different languages, means have send different notification messages(session flashdata's) each language can't utilize lang key in controller file. how can handle it?

thanks in advance.

i found it!

i have utilize this;

$this->session->set_flashdata('ok', $this->lang->line("greek"));

php codeigniter lang

No comments:

Post a Comment