# Is this right approach to get model data formmated html?

**URL:** <https://discourse.cakephp.org/t/is-this-right-approach-to-get-model-data-formmated-html/1574>\
**Category:** Need Help\
**Created:** [November 19, 2016, 5:58pm UTC](https://discourse.cakephp.org/t/is-this-right-approach-to-get-model-data-formmated-html/1574 "2016-11-19T17:58:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donnie](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Donnie](https://discourse.cakephp.org/u/Donnie)\
**Post date:** [November 19, 2016, 5:58pm UTC](https://discourse.cakephp.org/t/is-this-right-approach-to-get-model-data-formmated-html/1574/1 "2016-11-19T17:58:20Z")

</div>

I would like to know, if I am following the best practices of development in CakePHP framework.

If you have for a example an Invoices Table, and you want to display the status of the Invoice, let’s say you want a green label for the status of the invoice like this:

`<span class="green">Paid</span>`

What i do is the following. I create a virtualfield on my model named statuslabel, in that virtualfield i call a Helper that displays an element.

so it would be Model-\>Helper-\>Element

That way anywhere in my application i can call statuslabel like it was a field from that model and i would get the statuslabel.

My big question is if this is the right way to do it or i am doing it all wrong?
