Saturday, January 22, 2011

Proper MVC structure in CakePHP

Wondering if anyone cares to enlighten me about the proper cakePHP MVC
theory for my project.

I have numerous authoritative books. Each book is stored in a
separate database table with each paragraph in the book as a separate
record. Like so.

id int,
bookname varchar
chapternumber tinyint
paragraphnumber tinyint
paragraphtext text

All thru the project I am required to display quoted paragraphs from
these authoritative books, and would like to streamline as far a
possible with a helper the calls. Something like:

$this-CustomHelper->quoteText($id);

To display a formatted paragraph in the view across the project. My
confusion exists in exactly how to go about this in a proper way since
each quoted paragraph involves a call to the database in a find. And
I would like to use a number of helper functions to not only properly
format and link the quoted paragraph text, but also supply a link to
the entire chapter, chapter neighbors, and even the entire book.

So since I am dealing with a call to the database does this logic
belong in a behavior? A component? Or do I make the database call
and all the formatting logic in a view helper? Or some combination of
the above?

Thanks for your time.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate