Reputation: 157
In the index function of my controller I am calling getDirContents and I need to display the result of $data['arrDirContents'] in view
public function index()
{
$this->accesscontrol->can_or_redirect('view', 'translation');
$dir = './application/language/english';
$data['arrDirContents']=$this->getDirContents($dir, "~^.+_lang\.php$~i");
$this->output->view('translation/language',$data);
}
Any help on how to get the result of that function in view?
Upvotes: 0
Views: 641
Reputation: 157
$this->load->vars( array(
'arrDirContents'=>$this->getDirContents($dir, "~^.+_lang\.php$~i")
));
Upvotes: 0
Reputation: 403
<?php
$dir = './application/language/english';
$data['arrDirContents']=$this->getDirContents($dir, "~^.+_lang\.php$~i");
?>
If this values contents single value means
In View Page just do echo
<?php echo $arrDirContents; ?>
If this values contents multiple value having array value Do foreach print each variable value
<?php
foreach( $arrDirContents as $directs):
echo $directs;
endforech;
?>
Upvotes: 1