something similar asked here: building html structure in php or javascript?
with no answer. mine bit different. i'm start project "big div" on right side has main content+interaction while left side has present menu (not of interest us). "big div" on right changes content through calls like:
function calledbybutton() { parent.document.getelementbyid("content").innerhtml=loads in "big div" } now, content has stuff needs processed before displaying. i:
1) let php construct whole html content , dispatch javascript throws in "big div" (sounds laborious noob me having lotsa "echo (html lines)", did before. maybe thats standard , don't know.)
2) php sends data arrays, javascript interprets data , constructs content (humanly doable? javascript isn't strong point, doesn't sound bad , might more practical php?)
3) else?
thank time.
it safe bet follow recommended best practices , separate logic presentation. mean exactly?
in case mean
(1) use php return simple data in json format (i.e. involving business logic on side of application). ,
(2) use javascript template engine (mustache, handlebars, underscore) in front-end display received data like.
hope helps.
Comments
Post a Comment