couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Willox <skinti...@gmail.com>
Subject Re: best practice for dynamic content
Date Tue, 31 Jan 2012 20:15:10 GMT
I wrote a chat program with Node recently, and I rendered the content out
server-side, a pulled it in via AJAX. So, that should work.

You have PHP running so it would be really easy for your to render out the
content exactly how you wanted it with PHP and pull it in in exactly the
same fashion.


*In a matter of opinion, *

I don't think you necessarily have to render your content as HTML in the
Couch.DB view. You can just keep it as JSON data. The point in doing it
that way is to keep the Couch as a provider of data, especially if you have
PHP pulling the data and serving it.

Couch = data
PHP/Javascript Client = html rendering

Keeps it neat, then, if you ever decide to do something else with these
Couch views, you don't have any HTML getting in the way. You have raw JSON
which you can render in many different ways.


On Tue, Jan 31, 2012 at 10:55 AM, Jon Morehouse <MorehouseJ09@gmail.com>wrote:

> What I'm doing is assembling my code server side with php and passing it
> to views which are loaded on event functions with javascript. For instance,
> I'm working on an application that has articles, songs, videos etc so what
> I'm doing is getting my information from couchdb and depending upon a type
> field passing it to different views which then would be loaded. It really
> depends on your application though, because my situation deals with a chat
> like function where you are only adding one or two divs at a time. If you
> were adding several divs at a time then maybe it would be advisable to do a
> loop in your view function to recreate the information.
>
> Hope this helps
>
>
>
>
> Jon Morehouse
> Moeller High School Class of 2009
> Pepperdine University 2009-2010
> University of Southern California Class of 2013
>
>
>
>
> On Jan 31, 2012, at 9:47 AM, john.tiger wrote:
>
> > is it better practice to :
> > 1) put most div's in index.html - then hide with css display:none - then
> display:block / display:none with view events
> > 2) use lots of small template files called from views
> > 3) render html code in js view functions
> > 4) use html js scripts in index.html then call with view events
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message