質問編集履歴
2
weeklyが競合していたため、monthlyに書き換え
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,6 +92,324 @@
|
|
92
92
|
|
93
93
|
//月間ランキング
|
94
94
|
|
95
|
+
'monthly' =>
|
96
|
+
|
97
|
+
array (
|
98
|
+
|
99
|
+
0 =>
|
100
|
+
|
101
|
+
array (
|
102
|
+
|
103
|
+
'storyid' => '87231',
|
104
|
+
|
105
|
+
'title' => 'ランキングテスト1',
|
106
|
+
|
107
|
+
),
|
108
|
+
|
109
|
+
1 =>
|
110
|
+
|
111
|
+
array (
|
112
|
+
|
113
|
+
'storyid' => '87232',
|
114
|
+
|
115
|
+
'title' => 'ランキングテスト2',
|
116
|
+
|
117
|
+
),
|
118
|
+
|
119
|
+
2 =>
|
120
|
+
|
121
|
+
array (
|
122
|
+
|
123
|
+
'storyid' => '86707',
|
124
|
+
|
125
|
+
'title' => 'ランキングテスト3',
|
126
|
+
|
127
|
+
),
|
128
|
+
|
129
|
+
```
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
この配列にそれぞれ以下のデータを挿入しようと考えています。
|
134
|
+
|
135
|
+
・順位
|
136
|
+
|
137
|
+
・カテゴリ
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
最終的に以下の形にデータを整形したいと考えています。
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
var_export($newslist);
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
array() {
|
152
|
+
|
153
|
+
//日刊ランキング
|
154
|
+
|
155
|
+
'daily' =>
|
156
|
+
|
157
|
+
array (
|
158
|
+
|
159
|
+
0 =>
|
160
|
+
|
161
|
+
array (
|
162
|
+
|
163
|
+
'storyid' => '87231',
|
164
|
+
|
165
|
+
'title' => 'ランキングテスト1',
|
166
|
+
|
167
|
+
'rank' => 1,
|
168
|
+
|
169
|
+
'category_tag' =>
|
170
|
+
|
171
|
+
array (
|
172
|
+
|
173
|
+
0 =>
|
174
|
+
|
175
|
+
array (
|
176
|
+
|
177
|
+
'name' => 'カテゴリ1',
|
178
|
+
|
179
|
+
'search_key' => 'category1',
|
180
|
+
|
181
|
+
),
|
182
|
+
|
183
|
+
1 =>
|
184
|
+
|
185
|
+
array (
|
186
|
+
|
187
|
+
'name' => 'カテゴリ2',
|
188
|
+
|
189
|
+
'search_key' => 'category2',
|
190
|
+
|
191
|
+
),
|
192
|
+
|
193
|
+
2 =>
|
194
|
+
|
195
|
+
array (
|
196
|
+
|
197
|
+
'name' => 'カテゴリ3',
|
198
|
+
|
199
|
+
'search_key' => 'category3',
|
200
|
+
|
201
|
+
),
|
202
|
+
|
203
|
+
),
|
204
|
+
|
205
|
+
1 =>
|
206
|
+
|
207
|
+
array (
|
208
|
+
|
209
|
+
'storyid' => '87232',
|
210
|
+
|
211
|
+
'title' => 'ランキングテスト2',
|
212
|
+
|
213
|
+
'rank' => 1,
|
214
|
+
|
215
|
+
'category_tag' =>
|
216
|
+
|
217
|
+
array (
|
218
|
+
|
219
|
+
0 =>
|
220
|
+
|
221
|
+
array (
|
222
|
+
|
223
|
+
'name' => 'カテゴリ1',
|
224
|
+
|
225
|
+
'search_key' => 'category1',
|
226
|
+
|
227
|
+
),
|
228
|
+
|
229
|
+
1 =>
|
230
|
+
|
231
|
+
array (
|
232
|
+
|
233
|
+
'name' => 'カテゴリ2',
|
234
|
+
|
235
|
+
'search_key' => 'category2',
|
236
|
+
|
237
|
+
),
|
238
|
+
|
239
|
+
2 =>
|
240
|
+
|
241
|
+
array (
|
242
|
+
|
243
|
+
'name' => 'カテゴリ3',
|
244
|
+
|
245
|
+
'search_key' => 'category3',
|
246
|
+
|
247
|
+
),
|
248
|
+
|
249
|
+
),
|
250
|
+
|
251
|
+
),
|
252
|
+
|
253
|
+
2 =>
|
254
|
+
|
255
|
+
array (
|
256
|
+
|
257
|
+
'storyid' => '86707',
|
258
|
+
|
259
|
+
'title' => 'ランキングテスト3',
|
260
|
+
|
261
|
+
'rank' => 1,
|
262
|
+
|
263
|
+
'category_tag' =>
|
264
|
+
|
265
|
+
array (
|
266
|
+
|
267
|
+
0 =>
|
268
|
+
|
269
|
+
array (
|
270
|
+
|
271
|
+
'name' => 'カテゴリ1',
|
272
|
+
|
273
|
+
'search_key' => 'category1',
|
274
|
+
|
275
|
+
),
|
276
|
+
|
277
|
+
1 =>
|
278
|
+
|
279
|
+
array (
|
280
|
+
|
281
|
+
'name' => 'カテゴリ2',
|
282
|
+
|
283
|
+
'search_key' => 'category2',
|
284
|
+
|
285
|
+
),
|
286
|
+
|
287
|
+
2 =>
|
288
|
+
|
289
|
+
array (
|
290
|
+
|
291
|
+
'name' => 'カテゴリ3',
|
292
|
+
|
293
|
+
'search_key' => 'category3',
|
294
|
+
|
295
|
+
),
|
296
|
+
|
297
|
+
),
|
298
|
+
|
299
|
+
),
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
・
|
304
|
+
|
305
|
+
・
|
306
|
+
|
307
|
+
・
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
以下週間、月間を省略
|
312
|
+
|
313
|
+
```
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
### 現在のソースコード
|
318
|
+
|
319
|
+
```ここに言語を入力
|
320
|
+
|
321
|
+
//$newslist : 一番上で記述したデータが格納された変数
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
if(!empty($newslist))
|
326
|
+
|
327
|
+
{
|
328
|
+
|
329
|
+
foreach($newslist as $newslist_key => $newslist_value){
|
330
|
+
|
331
|
+
foreach($newslist_value as $k => $v){
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
//ランキング順位の情報を追加
|
336
|
+
|
337
|
+
$newslist_value[$k]["rank_num"] = $k+1;
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
//カテゴリを取得箇所をidから取得
|
342
|
+
|
343
|
+
$categories = $dispCat->getCategoryByStoryID($v["storyid"]);
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
$newslist_value[$k]["category_tag"] = $categories;
|
348
|
+
|
349
|
+
}
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
```
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
結果(内容変わらず)
|
362
|
+
|
363
|
+
```
|
364
|
+
|
365
|
+
var_export($newslist);
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
array() {
|
372
|
+
|
373
|
+
//日刊ランキング
|
374
|
+
|
375
|
+
'daily' =>
|
376
|
+
|
377
|
+
array (
|
378
|
+
|
379
|
+
0 =>
|
380
|
+
|
381
|
+
array (
|
382
|
+
|
383
|
+
'storyid' => '87231',
|
384
|
+
|
385
|
+
'title' => 'ランキングテスト1',
|
386
|
+
|
387
|
+
),
|
388
|
+
|
389
|
+
1 =>
|
390
|
+
|
391
|
+
array (
|
392
|
+
|
393
|
+
'storyid' => '87232',
|
394
|
+
|
395
|
+
'title' => 'ランキングテスト2',
|
396
|
+
|
397
|
+
),
|
398
|
+
|
399
|
+
2 =>
|
400
|
+
|
401
|
+
array (
|
402
|
+
|
403
|
+
'storyid' => '86707',
|
404
|
+
|
405
|
+
'title' => 'ランキングテスト3',
|
406
|
+
|
407
|
+
),
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
//週間ランキング
|
412
|
+
|
95
413
|
'weekly' =>
|
96
414
|
|
97
415
|
array (
|
@@ -126,289 +444,9 @@
|
|
126
444
|
|
127
445
|
),
|
128
446
|
|
129
|
-
|
447
|
+
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
448
|
+
|
134
|
-
|
135
|
-
・順位
|
136
|
-
|
137
|
-
・カテゴリ
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
最終的に以下の形にデータを整形したいと考えています。
|
142
|
-
|
143
|
-
```
|
144
|
-
|
145
|
-
var_export($newslist);
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
array() {
|
152
|
-
|
153
|
-
//日刊ランキング
|
154
|
-
|
155
|
-
'daily' =>
|
156
|
-
|
157
|
-
array (
|
158
|
-
|
159
|
-
0 =>
|
160
|
-
|
161
|
-
array (
|
162
|
-
|
163
|
-
'storyid' => '87231',
|
164
|
-
|
165
|
-
'title' => 'ランキングテスト1',
|
166
|
-
|
167
|
-
'rank' => 1,
|
168
|
-
|
169
|
-
'category_tag' =>
|
170
|
-
|
171
|
-
array (
|
172
|
-
|
173
|
-
0 =>
|
174
|
-
|
175
|
-
array (
|
176
|
-
|
177
|
-
'name' => 'カテゴリ1',
|
178
|
-
|
179
|
-
'search_key' => 'category1',
|
180
|
-
|
181
|
-
),
|
182
|
-
|
183
|
-
1 =>
|
184
|
-
|
185
|
-
array (
|
186
|
-
|
187
|
-
'name' => 'カテゴリ2',
|
188
|
-
|
189
|
-
'search_key' => 'category2',
|
190
|
-
|
191
|
-
),
|
192
|
-
|
193
|
-
2 =>
|
194
|
-
|
195
|
-
array (
|
196
|
-
|
197
|
-
'name' => 'カテゴリ3',
|
198
|
-
|
199
|
-
'search_key' => 'category3',
|
200
|
-
|
201
|
-
),
|
202
|
-
|
203
|
-
),
|
204
|
-
|
205
|
-
1 =>
|
206
|
-
|
207
|
-
array (
|
208
|
-
|
209
|
-
'storyid' => '87232',
|
210
|
-
|
211
|
-
'title' => 'ランキングテスト2',
|
212
|
-
|
213
|
-
'rank' => 1,
|
214
|
-
|
215
|
-
'category_tag' =>
|
216
|
-
|
217
|
-
array (
|
218
|
-
|
219
|
-
0 =>
|
220
|
-
|
221
|
-
array (
|
222
|
-
|
223
|
-
'name' => 'カテゴリ1',
|
224
|
-
|
225
|
-
'search_key' => 'category1',
|
226
|
-
|
227
|
-
),
|
228
|
-
|
229
|
-
1 =>
|
230
|
-
|
231
|
-
array (
|
232
|
-
|
233
|
-
'name' => 'カテゴリ2',
|
234
|
-
|
235
|
-
'search_key' => 'category2',
|
236
|
-
|
237
|
-
),
|
238
|
-
|
239
|
-
2 =>
|
240
|
-
|
241
|
-
array (
|
242
|
-
|
243
|
-
'name' => 'カテゴリ3',
|
244
|
-
|
245
|
-
'search_key' => 'category3',
|
246
|
-
|
247
|
-
),
|
248
|
-
|
249
|
-
),
|
250
|
-
|
251
|
-
),
|
252
|
-
|
253
|
-
2 =>
|
254
|
-
|
255
|
-
array (
|
256
|
-
|
257
|
-
'storyid' => '86707',
|
258
|
-
|
259
|
-
'title' => 'ランキングテスト3',
|
260
|
-
|
261
|
-
'rank' => 1,
|
262
|
-
|
263
|
-
'category_tag' =>
|
264
|
-
|
265
|
-
array (
|
266
|
-
|
267
|
-
0 =>
|
268
|
-
|
269
|
-
array (
|
270
|
-
|
271
|
-
'name' => 'カテゴリ1',
|
272
|
-
|
273
|
-
'search_key' => 'category1',
|
274
|
-
|
275
|
-
),
|
276
|
-
|
277
|
-
1 =>
|
278
|
-
|
279
|
-
array (
|
280
|
-
|
281
|
-
'name' => 'カテゴリ2',
|
282
|
-
|
283
|
-
'search_key' => 'category2',
|
284
|
-
|
285
|
-
),
|
286
|
-
|
287
|
-
2 =>
|
288
|
-
|
289
|
-
array (
|
290
|
-
|
291
|
-
'name' => 'カテゴリ3',
|
292
|
-
|
293
|
-
'search_key' => 'category3',
|
294
|
-
|
295
|
-
),
|
296
|
-
|
297
|
-
),
|
298
|
-
|
299
|
-
),
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
・
|
304
|
-
|
305
|
-
・
|
306
|
-
|
307
|
-
・
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
以下週間、月間を省略
|
312
|
-
|
313
|
-
```
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
### 現在のソースコード
|
318
|
-
|
319
|
-
```ここに言語を入力
|
320
|
-
|
321
|
-
//$newslist : 一番上で記述したデータが格納された変数
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
if(!empty($newslist))
|
326
|
-
|
327
|
-
{
|
328
|
-
|
329
|
-
foreach($newslist as $newslist_key => $newslist_value){
|
330
|
-
|
331
|
-
foreach($newslist_value as $k => $v){
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
//ランキング順位の情報を追加
|
336
|
-
|
337
|
-
$newslist_value[$k]["rank_num"] = $k+1;
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
//カテゴリを取得箇所をidから取得
|
342
|
-
|
343
|
-
$categories = $dispCat->getCategoryByStoryID($v["storyid"]);
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
$newslist_value[$k]["category_tag"] = $categories;
|
348
|
-
|
349
|
-
}
|
350
|
-
|
351
|
-
}
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
```
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
結果(内容変わらず)
|
362
|
-
|
363
|
-
```
|
364
|
-
|
365
|
-
var_export($newslist);
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
array() {
|
372
|
-
|
373
|
-
//日刊ランキング
|
374
|
-
|
375
|
-
'daily' =>
|
376
|
-
|
377
|
-
array (
|
378
|
-
|
379
|
-
0 =>
|
380
|
-
|
381
|
-
array (
|
382
|
-
|
383
|
-
'storyid' => '87231',
|
384
|
-
|
385
|
-
'title' => 'ランキングテスト1',
|
386
|
-
|
387
|
-
),
|
388
|
-
|
389
|
-
1 =>
|
390
|
-
|
391
|
-
array (
|
392
|
-
|
393
|
-
'storyid' => '87232',
|
394
|
-
|
395
|
-
'title' => 'ランキングテスト2',
|
396
|
-
|
397
|
-
),
|
398
|
-
|
399
|
-
2 =>
|
400
|
-
|
401
|
-
array (
|
402
|
-
|
403
|
-
'storyid' => '86707',
|
404
|
-
|
405
|
-
'title' => 'ランキングテスト3',
|
406
|
-
|
407
|
-
),
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
//
|
449
|
+
//月間ランキング
|
412
450
|
|
413
451
|
'weekly' =>
|
414
452
|
|
@@ -444,44 +482,6 @@
|
|
444
482
|
|
445
483
|
),
|
446
484
|
|
447
|
-
|
448
|
-
|
449
|
-
//月間ランキング
|
450
|
-
|
451
|
-
'weekly' =>
|
452
|
-
|
453
|
-
array (
|
454
|
-
|
455
|
-
0 =>
|
456
|
-
|
457
|
-
array (
|
458
|
-
|
459
|
-
'storyid' => '87231',
|
460
|
-
|
461
|
-
'title' => 'ランキングテスト1',
|
462
|
-
|
463
|
-
),
|
464
|
-
|
465
|
-
1 =>
|
466
|
-
|
467
|
-
array (
|
468
|
-
|
469
|
-
'storyid' => '87232',
|
470
|
-
|
471
|
-
'title' => 'ランキングテスト2',
|
472
|
-
|
473
|
-
),
|
474
|
-
|
475
|
-
2 =>
|
476
|
-
|
477
|
-
array (
|
478
|
-
|
479
|
-
'storyid' => '86707',
|
480
|
-
|
481
|
-
'title' => 'ランキングテスト3',
|
482
|
-
|
483
|
-
),
|
484
|
-
|
485
485
|
```
|
486
486
|
|
487
487
|
|
1
・var_dumpからvar_exportの表記に直しました。また、試したコードとその結果に関して記述しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,137 +6,125 @@
|
|
6
6
|
|
7
7
|
```
|
8
8
|
|
9
|
+
var_export($newslist);
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
9
|
-
array(
|
15
|
+
array() {
|
10
16
|
|
11
17
|
//日刊ランキング
|
12
18
|
|
13
|
-
|
19
|
+
'daily' =>
|
14
|
-
|
20
|
+
|
15
|
-
array(
|
21
|
+
array (
|
16
|
-
|
22
|
+
|
17
|
-
|
23
|
+
0 =>
|
18
|
-
|
24
|
+
|
19
|
-
array(
|
25
|
+
array (
|
20
|
-
|
21
|
-
|
26
|
+
|
22
|
-
|
23
|
-
stri
|
27
|
+
'storyid' => '87231',
|
24
|
-
|
25
|
-
|
28
|
+
|
26
|
-
|
27
|
-
|
29
|
+
'title' => 'ランキングテスト1',
|
30
|
+
|
28
|
-
|
31
|
+
),
|
32
|
+
|
29
|
-
|
33
|
+
1 =>
|
30
|
-
|
34
|
+
|
31
|
-
array(
|
35
|
+
array (
|
32
|
-
|
33
|
-
|
36
|
+
|
34
|
-
|
35
|
-
stri
|
37
|
+
'storyid' => '87232',
|
36
|
-
|
37
|
-
|
38
|
+
|
38
|
-
|
39
|
-
|
39
|
+
'title' => 'ランキングテスト2',
|
40
|
+
|
40
|
-
|
41
|
+
),
|
42
|
+
|
41
|
-
|
43
|
+
2 =>
|
42
|
-
|
44
|
+
|
43
|
-
array(
|
45
|
+
array (
|
44
|
-
|
45
|
-
|
46
|
+
|
46
|
-
|
47
|
-
stri
|
47
|
+
'storyid' => '86707',
|
48
|
-
|
49
|
-
|
48
|
+
|
50
|
-
|
51
|
-
|
49
|
+
'title' => 'ランキングテスト3',
|
50
|
+
|
51
|
+
),
|
52
52
|
|
53
53
|
|
54
54
|
|
55
55
|
//週間ランキング
|
56
56
|
|
57
|
-
|
57
|
+
'weekly' =>
|
58
|
-
|
58
|
+
|
59
|
-
array(
|
59
|
+
array (
|
60
|
-
|
60
|
+
|
61
|
-
|
61
|
+
0 =>
|
62
|
-
|
62
|
+
|
63
|
-
array(
|
63
|
+
array (
|
64
|
-
|
65
|
-
|
64
|
+
|
66
|
-
|
67
|
-
stri
|
65
|
+
'storyid' => '87231',
|
68
|
-
|
69
|
-
|
66
|
+
|
70
|
-
|
71
|
-
|
67
|
+
'title' => 'ランキングテスト1',
|
68
|
+
|
72
|
-
|
69
|
+
),
|
70
|
+
|
73
|
-
|
71
|
+
1 =>
|
74
|
-
|
72
|
+
|
75
|
-
array(
|
73
|
+
array (
|
76
|
-
|
77
|
-
|
74
|
+
|
78
|
-
|
79
|
-
stri
|
75
|
+
'storyid' => '87232',
|
80
|
-
|
81
|
-
|
76
|
+
|
82
|
-
|
83
|
-
|
77
|
+
'title' => 'ランキングテスト2',
|
78
|
+
|
84
|
-
|
79
|
+
),
|
80
|
+
|
85
|
-
|
81
|
+
2 =>
|
86
|
-
|
82
|
+
|
87
|
-
array(
|
83
|
+
array (
|
88
|
-
|
89
|
-
|
84
|
+
|
90
|
-
|
91
|
-
stri
|
85
|
+
'storyid' => '86707',
|
92
|
-
|
93
|
-
|
86
|
+
|
94
|
-
|
95
|
-
|
87
|
+
'title' => 'ランキングテスト3',
|
88
|
+
|
89
|
+
),
|
96
90
|
|
97
91
|
|
98
92
|
|
99
93
|
//月間ランキング
|
100
94
|
|
101
|
-
|
95
|
+
'weekly' =>
|
102
|
-
|
96
|
+
|
103
|
-
array(
|
97
|
+
array (
|
104
|
-
|
98
|
+
|
105
|
-
|
99
|
+
0 =>
|
106
|
-
|
100
|
+
|
107
|
-
array(
|
101
|
+
array (
|
108
|
-
|
109
|
-
|
102
|
+
|
110
|
-
|
111
|
-
stri
|
103
|
+
'storyid' => '87231',
|
112
|
-
|
113
|
-
|
104
|
+
|
114
|
-
|
115
|
-
|
105
|
+
'title' => 'ランキングテスト1',
|
106
|
+
|
116
|
-
|
107
|
+
),
|
108
|
+
|
117
|
-
|
109
|
+
1 =>
|
118
|
-
|
110
|
+
|
119
|
-
array(
|
111
|
+
array (
|
120
|
-
|
121
|
-
|
112
|
+
|
122
|
-
|
123
|
-
stri
|
113
|
+
'storyid' => '87232',
|
124
|
-
|
125
|
-
|
114
|
+
|
126
|
-
|
127
|
-
|
115
|
+
'title' => 'ランキングテスト2',
|
116
|
+
|
128
|
-
|
117
|
+
),
|
118
|
+
|
129
|
-
|
119
|
+
2 =>
|
130
|
-
|
120
|
+
|
131
|
-
array(
|
121
|
+
array (
|
132
|
-
|
133
|
-
|
122
|
+
|
134
|
-
|
135
|
-
stri
|
123
|
+
'storyid' => '86707',
|
136
|
-
|
137
|
-
|
124
|
+
|
138
|
-
|
139
|
-
|
125
|
+
'title' => 'ランキングテスト3',
|
126
|
+
|
127
|
+
),
|
140
128
|
|
141
129
|
```
|
142
130
|
|
@@ -154,245 +142,161 @@
|
|
154
142
|
|
155
143
|
```
|
156
144
|
|
157
|
-
arr
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
stri
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
array(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
array(
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
str
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
array(
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
str
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
a
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
str
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
a
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
["search_key"]=>
|
314
|
-
|
315
|
-
string(12) "category1"
|
316
|
-
|
317
|
-
}
|
318
|
-
|
319
|
-
}
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
[1]=>
|
324
|
-
|
325
|
-
array(3) {
|
326
|
-
|
327
|
-
["id"]=>
|
328
|
-
|
329
|
-
string(6) "746693"
|
330
|
-
|
331
|
-
["title"]=>
|
332
|
-
|
333
|
-
string(81) "ランキングその2"
|
334
|
-
|
335
|
-
["rank"] =>
|
336
|
-
|
337
|
-
int(2)
|
338
|
-
|
339
|
-
["category_tag"]=>
|
340
|
-
|
341
|
-
array(1) {
|
342
|
-
|
343
|
-
[0]=>
|
344
|
-
|
345
|
-
array(2) {
|
346
|
-
|
347
|
-
["name"]=>
|
348
|
-
|
349
|
-
string(6) "カテゴリその2"
|
350
|
-
|
351
|
-
["search_key"]=>
|
352
|
-
|
353
|
-
string(12) "category2"
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
}
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
[2]=>
|
362
|
-
|
363
|
-
array(3) {
|
364
|
-
|
365
|
-
["id"]=>
|
366
|
-
|
367
|
-
string(6) "746694"
|
368
|
-
|
369
|
-
["title"]=>
|
370
|
-
|
371
|
-
string(81) "ランキングその3"
|
372
|
-
|
373
|
-
["rank"] =>
|
374
|
-
|
375
|
-
int(3)
|
376
|
-
|
377
|
-
["category_tag"]=>
|
378
|
-
|
379
|
-
array(1) {
|
380
|
-
|
381
|
-
[0]=>
|
382
|
-
|
383
|
-
array(2) {
|
384
|
-
|
385
|
-
["name"]=>
|
386
|
-
|
387
|
-
string(6) "カテゴリその3"
|
388
|
-
|
389
|
-
["search_key"]=>
|
390
|
-
|
391
|
-
string(12) "category3"
|
392
|
-
|
393
|
-
}
|
394
|
-
|
395
|
-
}
|
145
|
+
var_export($newslist);
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
array() {
|
152
|
+
|
153
|
+
//日刊ランキング
|
154
|
+
|
155
|
+
'daily' =>
|
156
|
+
|
157
|
+
array (
|
158
|
+
|
159
|
+
0 =>
|
160
|
+
|
161
|
+
array (
|
162
|
+
|
163
|
+
'storyid' => '87231',
|
164
|
+
|
165
|
+
'title' => 'ランキングテスト1',
|
166
|
+
|
167
|
+
'rank' => 1,
|
168
|
+
|
169
|
+
'category_tag' =>
|
170
|
+
|
171
|
+
array (
|
172
|
+
|
173
|
+
0 =>
|
174
|
+
|
175
|
+
array (
|
176
|
+
|
177
|
+
'name' => 'カテゴリ1',
|
178
|
+
|
179
|
+
'search_key' => 'category1',
|
180
|
+
|
181
|
+
),
|
182
|
+
|
183
|
+
1 =>
|
184
|
+
|
185
|
+
array (
|
186
|
+
|
187
|
+
'name' => 'カテゴリ2',
|
188
|
+
|
189
|
+
'search_key' => 'category2',
|
190
|
+
|
191
|
+
),
|
192
|
+
|
193
|
+
2 =>
|
194
|
+
|
195
|
+
array (
|
196
|
+
|
197
|
+
'name' => 'カテゴリ3',
|
198
|
+
|
199
|
+
'search_key' => 'category3',
|
200
|
+
|
201
|
+
),
|
202
|
+
|
203
|
+
),
|
204
|
+
|
205
|
+
1 =>
|
206
|
+
|
207
|
+
array (
|
208
|
+
|
209
|
+
'storyid' => '87232',
|
210
|
+
|
211
|
+
'title' => 'ランキングテスト2',
|
212
|
+
|
213
|
+
'rank' => 1,
|
214
|
+
|
215
|
+
'category_tag' =>
|
216
|
+
|
217
|
+
array (
|
218
|
+
|
219
|
+
0 =>
|
220
|
+
|
221
|
+
array (
|
222
|
+
|
223
|
+
'name' => 'カテゴリ1',
|
224
|
+
|
225
|
+
'search_key' => 'category1',
|
226
|
+
|
227
|
+
),
|
228
|
+
|
229
|
+
1 =>
|
230
|
+
|
231
|
+
array (
|
232
|
+
|
233
|
+
'name' => 'カテゴリ2',
|
234
|
+
|
235
|
+
'search_key' => 'category2',
|
236
|
+
|
237
|
+
),
|
238
|
+
|
239
|
+
2 =>
|
240
|
+
|
241
|
+
array (
|
242
|
+
|
243
|
+
'name' => 'カテゴリ3',
|
244
|
+
|
245
|
+
'search_key' => 'category3',
|
246
|
+
|
247
|
+
),
|
248
|
+
|
249
|
+
),
|
250
|
+
|
251
|
+
),
|
252
|
+
|
253
|
+
2 =>
|
254
|
+
|
255
|
+
array (
|
256
|
+
|
257
|
+
'storyid' => '86707',
|
258
|
+
|
259
|
+
'title' => 'ランキングテスト3',
|
260
|
+
|
261
|
+
'rank' => 1,
|
262
|
+
|
263
|
+
'category_tag' =>
|
264
|
+
|
265
|
+
array (
|
266
|
+
|
267
|
+
0 =>
|
268
|
+
|
269
|
+
array (
|
270
|
+
|
271
|
+
'name' => 'カテゴリ1',
|
272
|
+
|
273
|
+
'search_key' => 'category1',
|
274
|
+
|
275
|
+
),
|
276
|
+
|
277
|
+
1 =>
|
278
|
+
|
279
|
+
array (
|
280
|
+
|
281
|
+
'name' => 'カテゴリ2',
|
282
|
+
|
283
|
+
'search_key' => 'category2',
|
284
|
+
|
285
|
+
),
|
286
|
+
|
287
|
+
2 =>
|
288
|
+
|
289
|
+
array (
|
290
|
+
|
291
|
+
'name' => 'カテゴリ3',
|
292
|
+
|
293
|
+
'search_key' => 'category3',
|
294
|
+
|
295
|
+
),
|
296
|
+
|
297
|
+
),
|
298
|
+
|
299
|
+
),
|
396
300
|
|
397
301
|
|
398
302
|
|
@@ -402,17 +306,21 @@
|
|
402
306
|
|
403
307
|
・
|
404
308
|
|
309
|
+
|
310
|
+
|
405
|
-
|
311
|
+
以下週間、月間を省略
|
406
|
-
|
312
|
+
|
407
|
-
```
|
313
|
+
```
|
408
|
-
|
409
|
-
|
410
|
-
|
314
|
+
|
315
|
+
|
316
|
+
|
411
|
-
###
|
317
|
+
### 現在のソースコード
|
412
318
|
|
413
319
|
```ここに言語を入力
|
414
320
|
|
415
|
-
//$newslist
|
321
|
+
//$newslist : 一番上で記述したデータが格納された変数
|
322
|
+
|
323
|
+
|
416
324
|
|
417
325
|
if(!empty($newslist))
|
418
326
|
|
@@ -422,9 +330,19 @@
|
|
422
330
|
|
423
331
|
foreach($newslist_value as $k => $v){
|
424
332
|
|
333
|
+
|
334
|
+
|
335
|
+
//ランキング順位の情報を追加
|
336
|
+
|
425
|
-
$newslist_value[$k]["rank_num"] = $k+1;
|
337
|
+
$newslist_value[$k]["rank_num"] = $k+1;
|
338
|
+
|
339
|
+
|
340
|
+
|
426
|
-
|
341
|
+
//カテゴリを取得箇所をidから取得
|
342
|
+
|
427
|
-
$categories = $dispCat->getCategoryByStoryID($v["storyid"]);
|
343
|
+
$categories = $dispCat->getCategoryByStoryID($v["storyid"]);
|
344
|
+
|
345
|
+
|
428
346
|
|
429
347
|
$newslist_value[$k]["category_tag"] = $categories;
|
430
348
|
|
@@ -440,6 +358,134 @@
|
|
440
358
|
|
441
359
|
|
442
360
|
|
361
|
+
結果(内容変わらず)
|
362
|
+
|
363
|
+
```
|
364
|
+
|
365
|
+
var_export($newslist);
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
array() {
|
372
|
+
|
373
|
+
//日刊ランキング
|
374
|
+
|
375
|
+
'daily' =>
|
376
|
+
|
377
|
+
array (
|
378
|
+
|
379
|
+
0 =>
|
380
|
+
|
381
|
+
array (
|
382
|
+
|
383
|
+
'storyid' => '87231',
|
384
|
+
|
385
|
+
'title' => 'ランキングテスト1',
|
386
|
+
|
387
|
+
),
|
388
|
+
|
389
|
+
1 =>
|
390
|
+
|
391
|
+
array (
|
392
|
+
|
393
|
+
'storyid' => '87232',
|
394
|
+
|
395
|
+
'title' => 'ランキングテスト2',
|
396
|
+
|
397
|
+
),
|
398
|
+
|
399
|
+
2 =>
|
400
|
+
|
401
|
+
array (
|
402
|
+
|
403
|
+
'storyid' => '86707',
|
404
|
+
|
405
|
+
'title' => 'ランキングテスト3',
|
406
|
+
|
407
|
+
),
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
//週間ランキング
|
412
|
+
|
413
|
+
'weekly' =>
|
414
|
+
|
415
|
+
array (
|
416
|
+
|
417
|
+
0 =>
|
418
|
+
|
419
|
+
array (
|
420
|
+
|
421
|
+
'storyid' => '87231',
|
422
|
+
|
423
|
+
'title' => 'ランキングテスト1',
|
424
|
+
|
425
|
+
),
|
426
|
+
|
427
|
+
1 =>
|
428
|
+
|
429
|
+
array (
|
430
|
+
|
431
|
+
'storyid' => '87232',
|
432
|
+
|
433
|
+
'title' => 'ランキングテスト2',
|
434
|
+
|
435
|
+
),
|
436
|
+
|
437
|
+
2 =>
|
438
|
+
|
439
|
+
array (
|
440
|
+
|
441
|
+
'storyid' => '86707',
|
442
|
+
|
443
|
+
'title' => 'ランキングテスト3',
|
444
|
+
|
445
|
+
),
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
//月間ランキング
|
450
|
+
|
451
|
+
'weekly' =>
|
452
|
+
|
453
|
+
array (
|
454
|
+
|
455
|
+
0 =>
|
456
|
+
|
457
|
+
array (
|
458
|
+
|
459
|
+
'storyid' => '87231',
|
460
|
+
|
461
|
+
'title' => 'ランキングテスト1',
|
462
|
+
|
463
|
+
),
|
464
|
+
|
465
|
+
1 =>
|
466
|
+
|
467
|
+
array (
|
468
|
+
|
469
|
+
'storyid' => '87232',
|
470
|
+
|
471
|
+
'title' => 'ランキングテスト2',
|
472
|
+
|
473
|
+
),
|
474
|
+
|
475
|
+
2 =>
|
476
|
+
|
477
|
+
array (
|
478
|
+
|
479
|
+
'storyid' => '86707',
|
480
|
+
|
481
|
+
'title' => 'ランキングテスト3',
|
482
|
+
|
483
|
+
),
|
484
|
+
|
485
|
+
```
|
486
|
+
|
487
|
+
|
488
|
+
|
443
489
|
### 自分で調べたことや試したこと
|
444
490
|
|
445
491
|
・ランキング順位や、カテゴリの取得は既にできています。
|