Jump to content

Unique View for 3 different table data schema's - View should display based on


Recommended Posts

Hello,

 

I have a table that has 5 fields of data.

 

In many cases, not all of the fields have data in them.

 

Each time the View action of the Controller is requested, I would like to only display the fields that have content in them AND the tabular structure of the data will change based on the content as well.

 

So basically, I think I will need a unique View file for each type of data schema. And there are 3 schemes. For example,

 

Schema  |  1  |  2  |  3  |  4  |  5  |

 

A                X      X      X      X      X

B                X                        X      X

C                        X      X              X

 

As you can see, each schema has different data populated.

 

This tells me I will need 3 View structures to accommodate these schema's.

 

Can anyone make a recommendation on the best way to handle this in the CakePHP framework. I am thinking an if condition in the Controller, and then render() based on that, but its seems there would be a more conventional method.

 

Thanks for any thoughts on this.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.