Quantcast

DetailsViewHelper (sort of)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

DetailsViewHelper (sort of)

Léo Willian Kölln
As i´m implementing a CRUD i was trying to make a Helper to make the rendering of a Details screen more easy.

The question is, If there is a FormHelper that i can use to help me render labels and fields, why does not exists a Helper to output simple (direct) data from a Model?

I ask this because as i was trying to implement a Helper like this, one of the things is to determine the Label (as in a form, but no <label> tag), and there is no isolated implementation to get this info, only on the FormHelper->label(). In my opinion the implementation to get the "text" of a label should go on other place (maybe on the Helper base class?) as this is a separated concept.

I´m wrong? There is other way to get this data?

Léo Willian Kölln

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

Amit-6-3
Not entirely sure what you're looking for here. Regarding a simple way to to output data from the model, it seems simple enough to do:

<p>Field: <?php echo $model['Model']['field']; ?></p>

If you're looking for how FormHelper->label() formats the field name, you could reimplement the label function - http://api20.cakephp.org/view_source/form-helper#line-782

On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln wrote:
As i´m implementing a CRUD i was trying to make a Helper to make the rendering of a Details screen more easy.

The question is, If there is a FormHelper that i can use to help me render labels and fields, why does not exists a Helper to output simple (direct) data from a Model?

I ask this because as i was trying to implement a Helper like this, one of the things is to determine the Label (as in a form, but no <label> tag), and there is no isolated implementation to get this info, only on the FormHelper->label(). In my opinion the implementation to get the "text" of a label should go on other place (maybe on the Helper base class?) as this is a separated concept.

I´m wrong? There is other way to get this data?

Léo Willian Kölln

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

Léo Willian Kölln
Yes, What i´m doing is this, but this is what i want to avoid. As you see, you need to "manually" write the label. What if it changes? If it was not a problem, FormHelper would not implement a solution for this (label).

In my helper implementation i´m already using the formHelper label method implementation (almost full copy and paste). What i´m arguing is that a method for retrieving the Label text should be in other place, and the formHelper::label() method should use it.

Léo Willian Kölln


On Wed, Sep 19, 2012 at 2:28 PM, Amit <[hidden email]> wrote:
Not entirely sure what you're looking for here. Regarding a simple way to to output data from the model, it seems simple enough to do:

<p>Field: <?php echo $model['Model']['field']; ?></p>

If you're looking for how FormHelper->label() formats the field name, you could reimplement the label function - http://api20.cakephp.org/view_source/form-helper#line-782

On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln wrote:
As i´m implementing a CRUD i was trying to make a Helper to make the rendering of a Details screen more easy.

The question is, If there is a FormHelper that i can use to help me render labels and fields, why does not exists a Helper to output simple (direct) data from a Model?

I ask this because as i was trying to implement a Helper like this, one of the things is to determine the Label (as in a form, but no <label> tag), and there is no isolated implementation to get this info, only on the FormHelper->label(). In my opinion the implementation to get the "text" of a label should go on other place (maybe on the Helper base class?) as this is a separated concept.

I´m wrong? There is other way to get this data?

Léo Willian Kölln

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

lowpass
What do you mean by "manually"? The point of writing it like that is
that it will display the new value if you change it in the DB.

Or are you referring to the column name? But you need to provide that
to FormHelper anyway.

I don't understand what problem you're trying to fix but there is the
Model::schema() method. Perhaps that will help with whatever you're
trying to do.

On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln <[hidden email]> wrote:

> Yes, What i´m doing is this, but this is what i want to avoid. As you see,
> you need to "manually" write the label. What if it changes? If it was not a
> problem, FormHelper would not implement a solution for this (label).
>
> In my helper implementation i´m already using the formHelper label method
> implementation (almost full copy and paste). What i´m arguing is that a
> method for retrieving the Label text should be in other place, and the
> formHelper::label() method should use it.
>
> Léo Willian Kölln
>
>
>
> On Wed, Sep 19, 2012 at 2:28 PM, Amit <[hidden email]> wrote:
>>
>> Not entirely sure what you're looking for here. Regarding a simple way to
>> to output data from the model, it seems simple enough to do:
>>
>> <p>Field: <?php echo $model['Model']['field']; ?></p>
>>
>> If you're looking for how FormHelper->label() formats the field name, you
>> could reimplement the label function -
>> http://api20.cakephp.org/view_source/form-helper#line-782
>>
>> On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
>> wrote:
>>>
>>> As i´m implementing a CRUD i was trying to make a Helper to make the
>>> rendering of a Details screen more easy.
>>>
>>> The question is, If there is a FormHelper that i can use to help me
>>> render labels and fields, why does not exists a Helper to output simple
>>> (direct) data from a Model?
>>>
>>> I ask this because as i was trying to implement a Helper like this, one
>>> of the things is to determine the Label (as in a form, but no <label> tag),
>>> and there is no isolated implementation to get this info, only on the
>>> FormHelper->label(). In my opinion the implementation to get the "text" of a
>>> label should go on other place (maybe on the Helper base class?) as this is
>>> a separated concept.
>>>
>>> I´m wrong? There is other way to get this data?
>>>
>>> Léo Willian Kölln
>>
>> --
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [hidden email].
>> To unsubscribe from this group, send email to
>> [hidden email].
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to
> [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

Léo Willian Kölln
Yes, the column name (label).

And no, i don't need to provide it on the FormHelper (necessarily).
I will use the method schema, but to implement a separate centralized label definition on the model (o thing that i think should already be on the Framework (suggestion)).

Thanks guys.

Léo Willian Kölln


On Thu, Sep 20, 2012 at 6:54 PM, lowpass <[hidden email]> wrote:
What do you mean by "manually"? The point of writing it like that is
that it will display the new value if you change it in the DB.

Or are you referring to the column name? But you need to provide that
to FormHelper anyway.

I don't understand what problem you're trying to fix but there is the
Model::schema() method. Perhaps that will help with whatever you're
trying to do.

On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln <[hidden email]> wrote:
> Yes, What i´m doing is this, but this is what i want to avoid. As you see,
> you need to "manually" write the label. What if it changes? If it was not a
> problem, FormHelper would not implement a solution for this (label).
>
> In my helper implementation i´m already using the formHelper label method
> implementation (almost full copy and paste). What i´m arguing is that a
> method for retrieving the Label text should be in other place, and the
> formHelper::label() method should use it.
>
> Léo Willian Kölln
>
>
>
> On Wed, Sep 19, 2012 at 2:28 PM, Amit <[hidden email]> wrote:
>>
>> Not entirely sure what you're looking for here. Regarding a simple way to
>> to output data from the model, it seems simple enough to do:
>>
>> <p>Field: <?php echo $model['Model']['field']; ?></p>
>>
>> If you're looking for how FormHelper->label() formats the field name, you
>> could reimplement the label function -
>> http://api20.cakephp.org/view_source/form-helper#line-782
>>
>> On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
>> wrote:
>>>
>>> As i´m implementing a CRUD i was trying to make a Helper to make the
>>> rendering of a Details screen more easy.
>>>
>>> The question is, If there is a FormHelper that i can use to help me
>>> render labels and fields, why does not exists a Helper to output simple
>>> (direct) data from a Model?
>>>
>>> I ask this because as i was trying to implement a Helper like this, one
>>> of the things is to determine the Label (as in a form, but no <label> tag),
>>> and there is no isolated implementation to get this info, only on the
>>> FormHelper->label(). In my opinion the implementation to get the "text" of a
>>> label should go on other place (maybe on the Helper base class?) as this is
>>> a separated concept.
>>>
>>> I´m wrong? There is other way to get this data?
>>>
>>> Léo Willian Kölln
>>
>> --
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [hidden email].
>> To unsubscribe from this group, send email to
>> [hidden email].
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to
> [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.



--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

lowpass
How do you not provide the column name (or alias)?

On Thu, Sep 20, 2012 at 11:00 PM, Léo Willian Kölln <[hidden email]> wrote:

> Yes, the column name (label).
>
> And no, i don't need to provide it on the FormHelper (necessarily).
> I will use the method schema, but to implement a separate centralized label
> definition on the model (o thing that i think should already be on the
> Framework (suggestion)).
>
> Thanks guys.
>
> Léo Willian Kölln
>
>
>
> On Thu, Sep 20, 2012 at 6:54 PM, lowpass <[hidden email]> wrote:
>>
>> What do you mean by "manually"? The point of writing it like that is
>> that it will display the new value if you change it in the DB.
>>
>> Or are you referring to the column name? But you need to provide that
>> to FormHelper anyway.
>>
>> I don't understand what problem you're trying to fix but there is the
>> Model::schema() method. Perhaps that will help with whatever you're
>> trying to do.
>>
>> On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln <[hidden email]>
>> wrote:
>> > Yes, What i´m doing is this, but this is what i want to avoid. As you
>> > see,
>> > you need to "manually" write the label. What if it changes? If it was
>> > not a
>> > problem, FormHelper would not implement a solution for this (label).
>> >
>> > In my helper implementation i´m already using the formHelper label
>> > method
>> > implementation (almost full copy and paste). What i´m arguing is that a
>> > method for retrieving the Label text should be in other place, and the
>> > formHelper::label() method should use it.
>> >
>> > Léo Willian Kölln
>> >
>> >
>> >
>> > On Wed, Sep 19, 2012 at 2:28 PM, Amit <[hidden email]> wrote:
>> >>
>> >> Not entirely sure what you're looking for here. Regarding a simple way
>> >> to
>> >> to output data from the model, it seems simple enough to do:
>> >>
>> >> <p>Field: <?php echo $model['Model']['field']; ?></p>
>> >>
>> >> If you're looking for how FormHelper->label() formats the field name,
>> >> you
>> >> could reimplement the label function -
>> >> http://api20.cakephp.org/view_source/form-helper#line-782
>> >>
>> >> On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
>> >> wrote:
>> >>>
>> >>> As i´m implementing a CRUD i was trying to make a Helper to make the
>> >>> rendering of a Details screen more easy.
>> >>>
>> >>> The question is, If there is a FormHelper that i can use to help me
>> >>> render labels and fields, why does not exists a Helper to output
>> >>> simple
>> >>> (direct) data from a Model?
>> >>>
>> >>> I ask this because as i was trying to implement a Helper like this,
>> >>> one
>> >>> of the things is to determine the Label (as in a form, but no <label>
>> >>> tag),
>> >>> and there is no isolated implementation to get this info, only on the
>> >>> FormHelper->label(). In my opinion the implementation to get the
>> >>> "text" of a
>> >>> label should go on other place (maybe on the Helper base class?) as
>> >>> this is
>> >>> a separated concept.
>> >>>
>> >>> I´m wrong? There is other way to get this data?
>> >>>
>> >>> Léo Willian Kölln
>> >>
>> >> --
>> >> Like Us on FacekBook https://www.facebook.com/CakePHP
>> >> Find us on Twitter http://twitter.com/CakePHP
>> >>
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "CakePHP" group.
>> >> To post to this group, send email to [hidden email].
>> >> To unsubscribe from this group, send email to
>> >> [hidden email].
>> >> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >>
>> >>
>> >
>> >
>> > --
>> > Like Us on FacekBook https://www.facebook.com/CakePHP
>> > Find us on Twitter http://twitter.com/CakePHP
>> >
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "CakePHP" group.
>> > To post to this group, send email to [hidden email].
>> > To unsubscribe from this group, send email to
>> > [hidden email].
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >
>> >
>>
>> --
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [hidden email].
>> To unsubscribe from this group, send email to
>> [hidden email].
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to
> [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DetailsViewHelper (sort of)

Léo Willian Kölln
What i'm talking about is $this->Form->input("you_name_it") will generate a <label>You Name It</label> and one input.

There is no generic method so i can generate this "label text" based on the column name (except of the FormHelper).

A helper to output this type of data would be nice (a "label" and the data based on the "column" of a model). Rebember, i'm not talking about a form here, i want same data, different "outputting".

I have an idea how to do it, i'm just saying a stock one may be helpful to other people and save some work...

Léo Willian Kölln


On Fri, Sep 21, 2012 at 12:24 AM, lowpass <[hidden email]> wrote:
How do you not provide the column name (or alias)?

On Thu, Sep 20, 2012 at 11:00 PM, Léo Willian Kölln <[hidden email]> wrote:
> Yes, the column name (label).
>
> And no, i don't need to provide it on the FormHelper (necessarily).
> I will use the method schema, but to implement a separate centralized label
> definition on the model (o thing that i think should already be on the
> Framework (suggestion)).
>
> Thanks guys.
>
> Léo Willian Kölln
>
>
>
> On Thu, Sep 20, 2012 at 6:54 PM, lowpass <[hidden email]> wrote:
>>
>> What do you mean by "manually"? The point of writing it like that is
>> that it will display the new value if you change it in the DB.
>>
>> Or are you referring to the column name? But you need to provide that
>> to FormHelper anyway.
>>
>> I don't understand what problem you're trying to fix but there is the
>> Model::schema() method. Perhaps that will help with whatever you're
>> trying to do.
>>
>> On Wed, Sep 19, 2012 at 3:59 PM, Léo Willian Kölln <[hidden email]>
>> wrote:
>> > Yes, What i´m doing is this, but this is what i want to avoid. As you
>> > see,
>> > you need to "manually" write the label. What if it changes? If it was
>> > not a
>> > problem, FormHelper would not implement a solution for this (label).
>> >
>> > In my helper implementation i´m already using the formHelper label
>> > method
>> > implementation (almost full copy and paste). What i´m arguing is that a
>> > method for retrieving the Label text should be in other place, and the
>> > formHelper::label() method should use it.
>> >
>> > Léo Willian Kölln
>> >
>> >
>> >
>> > On Wed, Sep 19, 2012 at 2:28 PM, Amit <[hidden email]> wrote:
>> >>
>> >> Not entirely sure what you're looking for here. Regarding a simple way
>> >> to
>> >> to output data from the model, it seems simple enough to do:
>> >>
>> >> <p>Field: <?php echo $model['Model']['field']; ?></p>
>> >>
>> >> If you're looking for how FormHelper->label() formats the field name,
>> >> you
>> >> could reimplement the label function -
>> >> http://api20.cakephp.org/view_source/form-helper#line-782
>> >>
>> >> On Wednesday, September 19, 2012 11:06:35 AM UTC-5, Léo Willian Kölln
>> >> wrote:
>> >>>
>> >>> As i´m implementing a CRUD i was trying to make a Helper to make the
>> >>> rendering of a Details screen more easy.
>> >>>
>> >>> The question is, If there is a FormHelper that i can use to help me
>> >>> render labels and fields, why does not exists a Helper to output
>> >>> simple
>> >>> (direct) data from a Model?
>> >>>
>> >>> I ask this because as i was trying to implement a Helper like this,
>> >>> one
>> >>> of the things is to determine the Label (as in a form, but no <label>
>> >>> tag),
>> >>> and there is no isolated implementation to get this info, only on the
>> >>> FormHelper->label(). In my opinion the implementation to get the
>> >>> "text" of a
>> >>> label should go on other place (maybe on the Helper base class?) as
>> >>> this is
>> >>> a separated concept.
>> >>>
>> >>> I´m wrong? There is other way to get this data?
>> >>>
>> >>> Léo Willian Kölln
>> >>
>> >> --
>> >> Like Us on FacekBook https://www.facebook.com/CakePHP
>> >> Find us on Twitter http://twitter.com/CakePHP
>> >>
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "CakePHP" group.
>> >> To post to this group, send email to [hidden email].
>> >> To unsubscribe from this group, send email to
>> >> [hidden email].
>> >> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >>
>> >>
>> >
>> >
>> > --
>> > Like Us on FacekBook https://www.facebook.com/CakePHP
>> > Find us on Twitter http://twitter.com/CakePHP
>> >
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "CakePHP" group.
>> > To post to this group, send email to [hidden email].
>> > To unsubscribe from this group, send email to
>> > [hidden email].
>> > Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> >
>> >
>>
>> --
>> Like Us on FacekBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [hidden email].
>> To unsubscribe from this group, send email to
>> [hidden email].
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to
> [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.



--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 
Loading...