here is my controller which will get the url information from some model function and passed it to my view.
class MyController extends CI_Controller{
public function __construct()
{
parent::__construct();
//load the settings model
//some model
//load the text helper
$this->load->helper('text');
}
public function index()
{
//call the model function to get the Url data
$data['urllist'] = //call the model function and get the array and store it to urllist;
//load the view
$this->load->view("myview",$data);
}
}
and my view is
<body>
<?php
/*
//$longurl is an array element and its value is
some thing like
http://example.com/sdsds/sdsdsd/sdsdsdsd/sdsdsd/sdsdsd
i want to truncate it about 20 characters
*/
$lurl=character_limiter($longurl, 20);
echo $lurl;
?>
</body>
but it shows full url. can I use character_limiter in view? or I have to truncate it in my controller and passed it to view?