teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

詳細な文法など

2019/07/30 05:35

投稿

twinparadox
twinparadox

スコア42

title CHANGED
File without changes
body CHANGED
@@ -1,26 +1,161 @@
1
1
  ### 前提・実現したいこと
2
+
2
3
  cloud9上でプレビューがみたい
3
- ここに質問の内容を詳しく書いてください。
4
+
4
- (例)PHP(CakePHP)で●●なシステムを作っています。
5
- ■■な機能を実装中に以下のエラーメッセージが発生しました。
6
5
  PHPでカレンダーアプリを作成中です。毎日プレビュー出来ていたのに急にプレビュー出来なくなりました。
7
6
  前日寝る前に実際に動く事は確認してます。
8
7
 
9
8
  ### 発生している問題・エラーメッセージ
9
+ cloud9↓
10
+
10
11
  One or more other sessions or collaborators are active on this environment. Switching to the minimal code completion engine to conserve memory.``
11
12
  エラーメッセージ
12
- ```
13
+ CSS↓
13
14
 
15
+ bash: line 1: styles.css: command not found
16
+
17
+
18
+ Process exited with code: 127
19
+
14
20
  ### 該当のソースコード
15
21
 
16
- ```ここに言語名を入力
22
+ CSS PHP
17
23
  ソースコード
24
+ body {
25
+ font-family: Arial, sans-serif;
26
+ font-size: 14px;
27
+ }
18
- ```
28
+ a {
29
+ text-decoration: none;
30
+ }
31
+ table {
32
+ margin: 15px auto;
33
+ border: 1px solid #ddd;
34
+ border-collapse: collapse;
35
+ }
36
+ th {
37
+ background: #eee;
38
+ }
39
+ th, td {
40
+ padding: 7px;
41
+ text-align: center;
42
+ }
19
43
 
44
+ .youbi_0 {
45
+ color: red;
46
+ }
47
+ .youbi_6 {
48
+ color: blue;
49
+ }
50
+ .today {
51
+ font-weight: bold;
52
+ }
53
+ .gray {
54
+ color: #dedede;
55
+ }
56
+
57
+
58
+ <?php
59
+
60
+ function h($s){
61
+ return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
62
+ }
63
+
64
+ try{
65
+ if (!isset($_GET['t']) || !preg_match('/\A\d{4}-\d{2}\z/', $_GET['t'])){
66
+ throw new Exception();
67
+
68
+ }
69
+ $thisMonth = new DateTime($_GET['t']);
70
+ } catch (Exception $e) {
71
+ $thisMonth = new DateTime('first day of this month');
72
+ }
73
+
74
+ $dt = clone $thisMonth;
75
+ $prev = $dt->modify('-1 month')->format('Y-m');
76
+ $dt = clone $thisMonth;
77
+ $next = $dt->modify('+1 month')->format('Y-m');
78
+ $yearMonth = $thisMonth->format('F Y');
79
+
80
+
81
+ $tail = '';
82
+ $lastDayOfPrevMonth = new DateTime('last day of ' . $yearMonth . ' -1 month');
83
+ while ($lastDayOfPrevMonth->format('w') < 6 ){
84
+ $tail = sprintf('<td class="gray">%d</td>', $lastDayOfPrevMonth->format('d')) . $tail;
85
+ $lastDayOfPrevMonth->sub(new DateInterval('P1D'));
86
+
87
+ }
88
+
89
+
90
+
91
+ $body = '';
92
+ $period = new DatePeriod(
93
+ new DateTime('first day of ' . $yearMonth),
94
+ new DateInterval('P1D'),
95
+ new DateTime('first day of ' . $yearMonth . '+1 month')
96
+ );
97
+ $today = new DateTime('today');
98
+
99
+ foreach ($period as $day) {
100
+ if ($day->format('w') % 7 === 0) { $body .= '</tr><tr>'; }
101
+ $todayclass = ($day->format('Y-m-d') === $today->format('Y-m-d')) ? 'today' : '';
102
+ $body .= sprintf('<td class="youbi_%d %s">%d</td>', $day->format('w'), $todayclass,$day->format('d'));
103
+ }
104
+ $head = '';
105
+ $firstDayOfNextMonth = new DateTime('first day of ' . $yearMonth . ' +1 month');
106
+ while ($firstDayOfNextMonth->format('w') > 0) {
107
+ $head .= sprintf('<td class="gray">%d</td>', $firstDayOfNextMonth->format('d'));
108
+ $firstDayOfNextMonth->add(new DateInterval('P1D'));
109
+
110
+ }
111
+ $html = '<tr>' . $tail . $body . $head . '</tr>';
112
+
113
+ ?>
114
+ <!DOCTYPE html>
115
+ <html lang="ja">
116
+ <head>
117
+ <meta charset="utf-8">
118
+ <title>Calendar</title>
119
+ <link rel="stylesheet" href="styles.css">
120
+ </head>
121
+ <body>
122
+ <table>
123
+ <thead>
124
+ <tr>
125
+ <th><a href="/?t=<?php echo h($prev); ?>">&laquo;</a></th>
126
+ <th colspan="5"><?php echo h($yearMonth); ?></th>
127
+ <th><a href="/?t=<?php echo h($next); ?>">&raquo;</a></th>
128
+ </tr>
129
+ </thead>
130
+ <tbody>
131
+ <tr>
132
+ <td>Sun</td>
133
+ <td>Mon</td>
134
+ <td>Tue</td>
135
+ <td>Wed</td>
136
+ <td>Thu</td>
137
+ <td>Fri</td>
138
+ <td>Sat</td>
139
+ </tr>
140
+ <?php echo $html; ?>
141
+
142
+ </tr>
143
+ </tbody>
144
+ <tfoot>
145
+ <tr>
146
+ <th colspan="7"><a href="/">Today</a></th>
147
+ </tr>
148
+ </tfoot>
149
+ </table>
150
+ </body>
151
+ </html>
152
+
20
153
  ### 試したこと
21
154
 
22
- ここに問題に対して試したことを記載してください。
155
+ runnerの変更
23
156
 
157
+ サインイン サインアウト
158
+
24
159
  ### 補足情報(FW/ツールのバージョンなど)
25
160
 
26
- ここより詳細な情報記載てください
161
+ 関係無いとは思いますがdookeeperてgithubとの連携をしました