On Tue, Jul 1, 2008 at 11:59 AM, geste <[EMAIL PROTECTED]> wrote:
>
> For several new CakePHP applications (I'll call them app1, app2,
> app3), I will need to implement a number of drop-down menus. These
> would be things like building codes that are already stored in a
> separate database (I'll call that the "lookup" database).
I think it's best to just repeat the data for each app. Unless you're
talking about millions of records, or if the lookup data is subject to
change, I don't think there's any big deal with sharing the info. My
use of this sort of thing usually involves a list of countries,
provinces, or similar. I just keep these things handy in their own SQL
file--one for Postgres and one for MySQL--and add them to my app as
needed.
> So, what I would like to do is have app1, app2 and app3 (each with
> their own database) use a shared set of functions that use lists/
> values pulled from the lookup database.
What sort of functions? Do you need to filter the data? Or are you
simply pulling it from the DB to create a select list?
> In the CakePHP 1.2 world is there an accepted or recommended way to do/
> organize this? As a component? A plug-in? I see a lot of examples
> of building menus/lists associated with each individual model, but not
> many examples that implement as a separate library using a different
> database as source of the model.
You probably want a behavior.
> Another use of this central "library" would be to provide functions/
> methods that display "friendly" values -- show building_name instead
> of building_id or show last_name+first_name instead of person_id.
You can set the displayField property before doing a find('list',
...). Also, have a look at the AutoField behavior:
http://cakeexplorer.wordpress.com/category/model/
> What I'd like to avoid is littering a bunch of these functions in each
> application.
>
> Any thoughts appreciated!
>
> Jim
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---