Various ways this could be done. A lot depends on how you need to call
the information throughout your app. Three possibilities are:

1. Store a "preview" field in your database and use the beforeSave
callback in the model to auto-populate/update the field from submitted
text;

2. Use the afterFind callback in the model to create a preview key in
the array of found data every time the article is, well, found!

3. Use SQL like SELECT SUBSTRING(my_text, 1, 500) FROM mytable, either
as a custom query or as a Cakeified query

Personally I would go with option 1 as it offers more flexibility in
the longer term

ianh

On Dec 8, 1:20 pm, Dilbert <[EMAIL PROTECTED]> wrote:
> Let's say I have an article with a text field that is the full
> content. How can I have a preview of the text in the home page
> limiting the numbers of phrases or words (a bit like in drupal)?
> Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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