Creating a page through Server-Side (PHP) or Client-Side (JS) Scripting?

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Creating a page through Server-Side (PHP) or Client-Side (JS) Scripting?

Years ago, I created a page called the Cross-Referenced Catalogue of DragonSpeak Lines. Now, the page is (currently) mostly created through JavaScript, as it needs JavaScript to be at all useful anyways. But recently I've started redoing it, and I was wondering--should I stick with generating the JSON file through PHP, and then creating the webpage itself using the JSON file for instructions, or should I simply create a massive page through PHP?

The current JSON file is 224KB, for your information--there's a LOT of stuff going into that file, as shown by three simple queries on the tables involved:

The current trend these days is a thick-client approach on the browser side (i.e. lots of JavaScript (e.g.: Angular or a similar framework)) which makes multiple calls to API endpoints on the server-side as needed to get the data it needs. As to whether that's the best approach for your needs versus just "what the cool kids are doing" is hard to say. IMO, it's probably only a preferred approach if you expect a lot of interaction on a browser page with your data: e.g. click on this to change what's displayed to that, then click on that to change what's displayed there, and so forth. As far as response time, it's probably faster -- in terms of initial page view response -- than downloading all the possible data so that it's all there for JavaScript to work with, depending on how much data we're talking about; but it could be just about as responsive to do it mainly on the server-side: providing a fresh page on each request. There's a lot of "it depends".
_