[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() {
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
$this->load->helper('text');
$this->load->scaffolding('entries');
}
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): ?>
<h2><?=$row->title?></h2>
<p><?=$row->character_limiter(body, 10);?></p>
<p><?=anchor('blog/comments/'.$row->id, 'Comments');?></p>
<hr>
<?php endforeach; ?>
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
$body_text = $row->body;
print character_limiter($body_text, 210);
?>