Page 1 of 1

Json Files - Coding Guidelines

Posted: 06 June 2020, 21:21
by MikeIsHere
Where would I put json files in my project? In the root or in the modules folder?

I am writing cribbage and hopefully I will allow for different board designs, therefore, I want to put the board zone positions in a json file so I can write the following pseudo code

loadJson(this.boardName)
for i=0 to 120
player_1_i style Left:jsonVal Top:jsonVal
this.array1 = createzone(player_1_i);
player_2_i style Left:jsonVal Top:jsonVal
this.array1 = createzone(player_2_i);

Then the better questions is: do I need to make zones or can I just absolutely position my marker -- what would zones really offer

Re: Json Files - Coding Guidelines

Posted: 06 June 2020, 22:52
by Tisaac
Why would you store them as JSON ?
A natural place for this in inside material.php (as an associative array) and then you can send this data to your frontend (if needed) using getAllData function.

Re: Json Files - Coding Guidelines

Posted: 07 June 2020, 13:38
by MikeIsHere
I was just thinking that since the server to client transfer is going from an associate array to Json anyway, why not just cut out the transformation and store the resulting json