Thursday, September 3, 2009

Re: Change default labeling in views

Thank you Brian,

Is there any existing mechanism to do such a substitution for labeling
automatically, i.e., change 'pops' (the table name) to 'populations'
automatically for presentation. Something along the lines of the
$displayField variable in the model?

On Sep 3, 11:02 am, brian <bally.z...@gmail.com> wrote:
> On Thu, Sep 3, 2009 at 10:51 AM, McScreech<scre...@sympatico.ca> wrote:
>
> > Hello,
>
> > What does the double underscore represent in the following code from
> > the head of the index.ctp file for the users view?
> >    <div class="users index">
> >    <h2><?php __('Users');?></h2>
>
> __() is a function in basics.php that is used to translate strings
> using the I18n class. If there's no .po file, or if the given key is
> not present in the .po file, the input string is simply returned. So,
> if you haven't set up internationalisation, it causes no harm. If you
> have no use for I18N, and want to save a few cycles here and there,
> you can strip out the PHP to change that to just <h2>Users</h2> (or
> whatever).
>
> > I can see the results in the rendered page, but the reason I ask is
> > that I would like to change this output without mucking up something
> > else unintentionally. I have setup my db with some tables using
> > abbreviated names, i.e., 'pops' rather than 'populations' for the
> > simple convenience of saving 7 keystrokes per instance in long lines
> > of code, or 'clons' rather than 'clones' which is a reserved word in
> > php.
>
> > TIA, McS
>
> > P.S. I've always chuckled at the ironic length of the word
> > 'abbreviation', or 'shortening' for that matter.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: