I'm trying to build a site using the 3 layer concept of data, application and presentation but I'm getting confused in the detail.
When there is a lot of dynamic content the application layer will be generating data for the presentation layer depending on the input from a user.
So for instance a search page result may have 4 results or 10. Usually I would loop the array fetched from SQL and the html would be added to in each loop cycle with the correct data either by a direct echo or appending a variable to be echo later in the program.
This of course means that there is html code in the application layer.
There seems no way around this as I have to produce 4 blocks of html sometimes 10 blocks of html and so on.
Is this concept just a myth or am I missing something?
Is your design object-oriented? If you use simple data objects to represent the data in the rows, you would load the data into those objects and pass the objects to the presentation layer. Here you would loop through the objects and mix their data fields in with the HTML code.
Msg#: 4117052 posted 11:11 am on Apr 18, 2010 (gmt 0)
Won't that result in more code though slowing the app down, I can see the point when a lot of pre-formatting of the data has to occur but say you just wanted to retrieve a short list from a database and present that accordingly with no data formatting then would this be over doing it?