I would rethink having each book in a table of its own; but Ryans
pointed that out already

the helper would be something like
$this->BookQuotation->display($id);

although:
1) I assume that $id being passed to the helper method is the id of
quotation - but if you are looping through the quotations available
for a given book then you could just as easily pass the actual quote
2) the helper should not query the db, but can get access to view vars
and set additional ones
3) perhaps making a helper is overly complex - would an element be easier?

helpers group a bunch of methods together to be easily used from
within the view, what other tasks is this helper performing?


On 23/01/2011, websurfshop <[email protected]> wrote:
> 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
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
>


-- 
 - S

+44 (0)7908 069 219

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to