I managed to include the TextHelper in the controller, but I don't
understand where to actually use the excerpt function. I'm new to
CakePHP.

My controller:
var $helpers = array('Html','Javascript', 'Ajax', 'RfRating', 'Text');

My view:
echo("<p>" . truncate($thisstory['Story']['plot']) . "</p>");

But that doesn't seem to work:
Fatal error: Call to undefined function truncate() in /Applications/
MAMP/htdocs/metatube/app/views/stories/index.thtml on line 7

On 6 mrt, 18:36, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> Well, if your stories are plain text data, you need to use TextHelper
> (http://api.cakephp.org/1.2/class_text_helper.html) in your view. The
> ticket you posted is a patch for making excerpts of html data.
>
> Toon Gorissen wrote:
> > I'm using the following code in my stories_controller:
>
> > function index(){
> >    $stories = $this->Story->findAll(null, array('id', 'plot', 'author',
> > 'created'), 'created DESC');
> >    $stories_array = array();
> >    foreach($stories as $story){
> >            $story_id = $story['Story']['id'];
> >            $stories_array[$story_id] = $this->RfRating-
> > >getRatingInfo($story_id, $_SERVER['REMOTE_ADDR']);
> >    }
> >    //$this->set('stories', $this->Story->findAll(null, array('id',
> > 'plot', 'author', 'created'), 'created DESC'));
> >    $this->set('stories', $stories);
> >    $this->set('ratingInfo', $stories_array);
> > }
>
> > Now I would like to truncate (or make an excerpt of) the plot
> > variable. I've read a ticket on makings exerpts (https://
> > trac.cakephp.org/ticket/2306), but I don't quite understand how to
> > implement it.
>
> > Could someone help me? Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to