That's what I'll probably end up doing since I'm still prototyping this stuff out. I'm guessing it would be better practice to have multiple view files instead of combining several views in one thtml file and also having several different controller actions. I'm just left here thinking about other views for the same data and making those views dynamic.
Okay, so here's a random thought. What if I put the thtml code of each view into the database. Then extract it in the controller and use the set method to set the code as a variable for the view. Then in the view eval() the code? Good idea or not? hm. On Jul 31, 12:02 pm, starkey <[EMAIL PROTECTED]> wrote: > I think I understand... It sounds to me like you should have two > actions, not > one:http://www.some.com/controller/viewList/http://www.some.com/controller/viewTable/ > > Having one view to encapsulate two doesn't sound correct... but I'm > still new at this myself. > > On Jul 31, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Thanks for the reply! > > > The problem I am running into is that I need different views for the > > same information. For example, when someone > > visitshttp://www.some.com/controller/view/1 > > it will show say a list of links. Inhttp://www.some.com/controller/view/2 > > it will show similar information from the database but as a table > > instead of a list of links. Right now for me to do this I set the a > > variable that holds the view that I want to show. So in my actual > > view.thtml file I have a switch statement off of this view variable I > > set in my controller so the actually view.thtml knows what view I need > > to show (in this example the list or the table). > > > Does this make sense? > > > On Jul 30, 5:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote: > > > > Are you talking about several different "skins", but really the same > > > data and presentation? Or are you talking about some non-trivial data > > > calculation, then you want to show the result in several independent > > > areas of your site? I'm just not sure of the reason for the several > > > views on a single action. > > > > For the former, have a variable (perhaps session) that determines > > > which layout to use, or even to choose another view file to render (if > > > the structure needs to be quite different). For the latter, you > > > should move the functionality into the appropriate model or component > > > file, so that it can be called from any number of controller actions > > > without duplication. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
