text helper - loaded, but character_limiter not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: text helper - loaded, but character_limiter not working (/showthread.php?tid=13929) |
text helper - loaded, but character_limiter not working - El Forum - 12-11-2008 [eluser]Brad Morse[/eluser] I recently completed the two blog tutorials and wanted to add to it. I loaded the text helper within the blog controller: Code: function Blog() { Then I tried to put a limit on the body part of the blog post within the blog view: Code: <?php foreach($query->result() as $row): ?> I receive this error; Fatal error: Call to undefined function: character_limiter() in /path_to/ci_system/application/views/blog_view.php on line 11 Line 11 is: Code: <p><?=$row->character_limiter(body, 10);?></p> I imagine this is a simple fix, any help is appreciated. Thank you. Edit: I tried this and it seems to work, but is there a better way of writing this? Code: <?php text helper - loaded, but character_limiter not working - El Forum - 12-11-2008 [eluser]missionsix[/eluser] Looks like you've figured out that helper functions are just functions and not methods attached to objects. With that said, you've done it correctly, but you shouldn't need to define a variable here. Code: <p><? echo character_limiter("$row->body", 10);?></p> text helper - loaded, but character_limiter not working - El Forum - 12-11-2008 [eluser]Brad Morse[/eluser] Perfect! Thank you! I appreciate the help, I was completely off from my original attempt, here is my original attempt at doing this below: Code: <p><?=$row->character_limiter(body, 10);?></p> Thanks again! |