CodeIgniter Forums

Full Version: character limiter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]benfike[/eluser]
Code:
function get_posts($options)
    {
        $short_title = character_limiter('post_title', 28);
        $short_intro = character_limiter('post_intro', 65);
        $this->db->select("*,YEAR(post_publicated_at) AS year,  
                             MONTH(post_publicated_at) AS month,
                             DAY(post_publicated_at) AS day,
                             ".$short_intro." AS short_intro,
                             ".$short_title." AS short_title");
        $this->db->join('posts', 'posts.post_id = posts_news.post_id');
        $this->db->where('posts.post_status','active');
        $this->db->where('posts_news.post_type',$options['post_type']);
        $this->db->where('posts.post_publicated_at <=', $this->_time);
        $this->db->order_by('posts_news.post_leading_article', 'desc');
        $this->db->order_by('posts.post_publicated_at', 'desc');
        $this->db->limit($options['limit'], $options['start']);
        return $this->db->get('posts_news')->result_array();
    }

why don't work the character limiter?
I have a post_title, post_intro field, but i have to character limit it as short_intro, short_title

Help me pls.