Sure you could do that. It's called using XML Transformations (XSLT), Javascript Templatating Engines, or a number of other approaches.
Django does this with its Template Engine. The reason this isn't completely ran on the Client-Side is because it would be slower, difficult to cache, and dependent upon some specific Client-Side technologies. Django lets you easily override this behavior. For example, there's documentation on using alternative Templating Engines. You could apply the same methodology to using Client-Side Templating Engines (written in Javascript), or even just displaying XML w/ XSLT using the Browser's Transformation Engine. I'm not really the most experienced person when it comes to Client-Side templates but I'm sure there's a lot out there in Google Land. On Mon, Oct 31, 2011 at 1:04 PM, Timmy O'Mahony <t.omahony.dub...@gmail.com>wrote: > The more I think about this the more I realize that what I'm talking about > IS exactly a REST api. > > If I write a phone app, I will code all the presentation layer locally on > the phone (client-side) and use json/xml to dynamically fetch data from the > server. > > Why isn't this the same for websites? - why isn't the presentation layer > completely client-side as opposed to 'a bit of both'? > > Ideally when a user requests a webpage from my server, I should deliver > the presentation layer to them, along with the information they require to > perform an API lookup. From then on they can query my server using the same > REST api a phone app would use. This would mean that all the information > from EVERY device accessing my website comes from the same api. This is > much better then my existing setup, where I might have an API for an app to > accompany my site, but I also have a jungle of urls and views to enable a > web browser use my site > > Am I just repeating/realizing something that is well know and catered for? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/f1xLB5KuZQAJ. > > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.