I am running this plugin
I am wondering, how the data set will look like ? I am new to query stings. I am trying to learn how to put 12 months data in one file. Is there an example of how the dataset look like for query strings because I am unable to find any.
For Example -- November DataSet
{
"1" :
{"fajr":"6:21 AM","sunrise":"7:31 AM","zuhr":"12:53 PM","asr":"3:51 PM","maghrib":"6:14 PM","isha":"7:25 PM","fajri":"6:30 AM","zuhri":"1:30 PM","asri":"4:30 PM","maghribi":"6:24 PM","ishai":"7:45 PM" ..... "fajri":"6:10 AM","zuhri":"12:45 PM","asri":"3:30 PM","maghribi":"5:07 PM","ishai":"7:15 PM"}, ......
"30" :
{"fajr":"5:44 AM","sunrise":"6:57 AM","zuhr":"11:58 AM","asr":"2:38 PM","maghrib":"4:57 PM","isha":"6:12 PM","fajri":"6:10 AM","zuhri":"12:45 PM","asri":"3:30 PM","maghribi":"5:07 PM","ishai":"7:15 PM"}
}
and December DataSet
{
"1" :
{"fajr":"5:47 AM","sunrise":"7:01 AM","zuhr":"11:59 AM","asr":"2:38 PM","maghrib":"4:57 PM","isha":"6:11 PM","fajri":"6:15 AM","zuhri":"12:45 PM","asri":"3:30 PM","maghribi":"5:07 PM","ishai":"7:15 PM"}, .....
"31":
{"fajr":"6:01 AM","sunrise":"7:16 AM","zuhr":"12:09 PM","asr":"2:44 PM","maghrib":"5:02 PM","isha":"6:18 PM","fajri":"6:30 AM","zuhri":"12:45 PM","asri":"3:30 PM","maghribi":"5:12 PM","ishai":"7:15 PM"}
}
As of now I have 12 individual files connected to the month. I want to know how can I put them all together under on PHP file and how the call function then works within the file. Like when in the script call for a month or day, how does it identifies in a query string dataset what is being called ...
Task 1: Convert the JSON string to array by json_decode($stringString, true /* True for return array, false for Object */ );
Task 2: Loop each of the months, every data (each day) will be store into another array with the key in date format. Such as '2013-12-01'.
Task 3: Save the array in JSON format file. file_put_contents($filePath, json_encode($finalArray) )
Something like that (For task 2)
<?
$finalArray = array();
//each month
foreach( $monthsJsonString as $month => $monthJson ){
$monthData = json_decode($monthJson, true);
//loop days
foreach( $monthData as $day => $dayData){
$dateStr = $year . '-' . $month . '-' . $day;
$finalArray[ $dateStr ] = $dayData
}
}
/*
//output
array(
'2013-11-01'=>array(
'fajr'=>'6:21 AM',
'sunrise'=>'7:31 AM',
...
'ishai'=>'7:15 PM'
),
'2013-11-02'=>array(
'fajr'=>'6:21 AM',
'sunrise'=>'7:31 AM',
...
'ishai'=>'7:15 PM'
),
...
'2013-12-31'=>array(
'fajr'=>'6:21 AM',
'sunrise'=>'7:31 AM',
...
'ishai'=>'7:15 PM'
)
)
*/
?>