0

I have a CakePHP website used by multiple clients. Each client shall be able to see slightly different input fields in forms. This is due to client preferences.

A simplified example: Clients should be able to look up books from a big list. While some clients prefer to look up by author, others might want to look up by publish date or title. But each client should only see one input field in his search page. I don't want to bother the client with too many choices.

While creating different themes and switching them for each client is an option, it quickly becomes a lot of work if we are talking about many views and many input fields. Same for placing lots of if/else in the view files.

The Controller logic could be shared for all clients, as an empty or not existing input field will be ignored by my controller when looking up books.

Optimal I have some kind of dynamic configuration which states for each client which input field to show or hide on which page.

Let me know any suggestions on this or what is a good CakePHP way to achieve this.

kaffeeguru
  • 111
  • 1
  • 6

1 Answers1

0

If I get this right just use an element per client:

echo $this->element('client_forms/' . $clientIdentifier);
floriank
  • 25,546
  • 9
  • 42
  • 66
  • Then I would need an element per client per view. – kaffeeguru Dec 18 '14 at 13:38
  • Also there might be some common markup between the input fields which should be easily changed (e.g. without editing 50 client elements.) I would prefer a solution which works without creating additional view files or elements. Something which can be configured in a database table for example. – kaffeeguru Dec 18 '14 at 13:41