Welcome Guest, Not a member yet? Register   Sign In
word_limiter() function is not working
#1

[eluser]codecombustor[/eluser]
it's a bit strange.....i have loaded the 'text' helper file in the controller, but when i try to use the word_limiter() function in the view file it just doesn't work...
#2

[eluser]jairoh_[/eluser]
really? did u specify the 2nd parameter which is the number of words per line?
#3

[eluser]codecombustor[/eluser]
of course i did......it seems like the function is not being identified.....
#4

[eluser]boltsabre[/eluser]
Post your code...
1. Have you loaded the correct helper?
2. Are you calling the correct function?
3. Are you passing in a string variable that is NOT a empty?
#5

[eluser]codecombustor[/eluser]
Controller :
public function __construct ()
{
parent::__construct();
...
...

$this->load->helper('text');
}

view file:
echo word_limiter($somestring, 4); // outputs the whole string
#6

[eluser]boltsabre[/eluser]
What is the value of $somestring? Is it longer than 4 words???

To be honest I've never used this function, and I'm at work right now and don't have a CI installation to play with. But some other things to try if your problem persists:

- Put an echo statement at the end of the helper, do you see it? If so then you know that the function is being called and run.
- Try autoloading the helper.
- Try loading the helper in your controller, not the constructor.
- Try assigning your string to a variable and then echo that (ie, $string = word_limiter($somestring, 4); echo $stringWink




Theme © iAndrew 2016 - Forum software by © MyBB