I don't know - because in truth I don't really understand what you are trying 
to do - but this *sounds like* a complex solution to something that could be 
fairly simple. You really need to break your data pieces down and understand 
the relationships between them, then create tables around that model. Each 
table has a unique id field and fields that relate each row to its parent. Then 
you associate them in your models and everything becomes easy, integral and 
robust. Using composite key fields sounds like an admin nightmare, not very 
scalable and a fertile area for errors. I would imagine that if the tables 
aren't normalised you are going to get some very large records and then 
performance problems. Something like this:

books => chapters => paragraphs
books => authors

...ought to be your starting place. In your quotePara example, $id is always 
going to be the id of the record holding that paragraph. You can get to that 
from pretty much anywhere if your model associations are right; e.g:

>From the Book controller; $paragraph = 
>$this->Book->Chapter->Paragraph->getParagraph($id);

You can then pass $paragraph into a view and display it.

Coding can be by its very nature repetitive (some of which is replaced by 
components, behaviours and helpers) and is much easier to follow if you do, in 
fact, make good use of the right ids displayed throughout your app. Don't fight 
it.

Jeremy Burns
Class Outfit

[email protected]
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 24 Jan 2011, at 04:53, websurfshop wrote:

> Thank you for the help on the database normalization, I will give it
> some more thought.  The book id field is actually a composite key that
> contains the book number, chapter number, and paragraph number, which
> can be exploded to decifer.  The entire book(s) will be in the
> database and I wanted to take advantage of mySQL full text search
> function, and at current it didn't make sense to start splitting
> tables for each book even those this is not currently normalized.
> 
> It would be really nice to be able to display a paragraph by simply
> calling;
> 
> echo $this->CustomHelper->quotePara($id);
> 
> without having to write a find query in a model, set the variable in
> the controller, then display the variable in the view everytime I want
> to display a paragraph on the website.  I am kinda new at this for
> sure (comp programming, PHP, cake, etc.)  as it's just a hobby.  Maybe
> there is no such animal.  I was hoping a custom helper/component/
> behavior whatnot would clean up my program making less repeat coding.
> In my custom helper I would also have functions to return the book
> title, chapter number, page number, paragraph number, etc., and format
> and link to view the source page, chapter, book, neighbors, etc.
> 
> Thanks for the help, things are becoming clearer as I think on it.
> 
> -- 
> 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

-- 
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