質問編集履歴

1

自己解決しようとして失敗

2019/10/19 21:40

投稿

sakurad
sakurad

スコア5

test CHANGED
File without changes
test CHANGED
@@ -41,3 +41,93 @@
41
41
  ```
42
42
 
43
43
  テンプレcgiに広告を追加したいのですが、以上のようにやってもうまく表示できません。どうしたら良いでしょうか。よろしくお願いします。
44
+
45
+
46
+
47
+ ```cgi
48
+
49
+ # ------------ #
50
+
51
+ # HTMLヘッダー #
52
+
53
+ # ------------ #
54
+
55
+ sub head{
56
+
57
+ print "Content-type: text/html; charset=Shift_JIS\n\n";
58
+
59
+ print <<EOM;
60
+
61
+ <html>
62
+
63
+ <head>
64
+
65
+ <link rel=stylesheet type=text/css href="$stylepath">
66
+
67
+ <title>$main_title</title>
68
+
69
+ </head>
70
+
71
+ EOM
72
+
73
+ if($background){ print"<body background=\"$background\">\n"; }
74
+
75
+ else{ print"<body>\n<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
76
+
77
+ <script>
78
+
79
+ (adsbygoogle = window.adsbygoogle || []).push({
80
+
81
+ google_ad_client: "ca-pub-8262824574470102",
82
+
83
+ enable_page_level_ads: true
84
+
85
+ });
86
+
87
+ </script>"; }
88
+
89
+ }
90
+
91
+
92
+
93
+
94
+
95
+ # -------------- #
96
+
97
+ # HTMLフッターー #
98
+
99
+ # -------------- #
100
+
101
+ sub foot{
102
+
103
+ # 著作権表示です
104
+
105
+ print <<EOM
106
+
107
+ <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
108
+
109
+ <script>
110
+
111
+ (adsbygoogle = window.adsbygoogle || []).push({
112
+
113
+ google_ad_client: "ca-pub-8262824574470102",
114
+
115
+ enable_page_level_ads: true
116
+
117
+ });
118
+
119
+ </script><DIV ALIGN="RIGHT"><SMALL><A HREF="http://www.minicgi.net/" target="_top">Miniりすと $ver</A></SMALL></DIV>
120
+
121
+ </body>
122
+
123
+ </html>
124
+
125
+ EOM
126
+
127
+ }
128
+
129
+ ```
130
+
131
+
132
+
133
+ にしたらInternal Server Errorになってしまいました。