質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

Q&A

0回答

2361閲覧

UseBB HTML入力元

tooker2

総合スコア13

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

0グッド

1クリップ

投稿2019/04/08 06:47

UseBBを利用してフォーラムを作成していますが、どこからHTMLを呼び出しているのかわかりません。
独自のmetaタグを追加したいそうです。
index.phpのソース載せておきます。

PHP

1<?php 2 3/* 4 Copyright (C) 2003-2012 UseBB Team 5 http://www.usebb.net 6 7 $Id$ 8 9 This file is part of UseBB. 10 11 UseBB is free software; you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation; either version 2 of the License, or 14 (at your option) any later version. 15 16 UseBB is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with UseBB; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24*/ 25 26/** 27 * Forum index 28 * 29 * Parses the forum index of the board. 30 * 31 * @author UseBB Team 32 * @link http://www.usebb.net 33 * @license GPL-2 34 * @version $Revision$ 35 * @copyright Copyright (C) 2003-2012 UseBB Team 36 * @package UseBB 37 */ 38 39define('INCLUDED', true); 40define('ROOT_PATH', './'); 41 42 43 44// 45// Include usebb engine 46// 47require(ROOT_PATH.'sources/common.php'); 48 49 50// 51// Update and get the session information 52// 53$session->update('index'); 54 55// 56// Include the page header 57// 58require(ROOT_PATH.'sources/page_head.php'); 59 60$template->add_breadcrumb($lang['ForumIndex']); 61 62// 63// Parse the forums 64// 65 66if ( !$functions->get_stats('forums') ) { 67 68 // 69 // No forums have been found. Output this notice. 70 // 71 $template->parse('msgbox', 'global', array( 72 'box_title' => $lang['Note'], 73 'content' => $lang['NoForums'] 74 )); 75 76} else { 77 78 // 79 // Define wich category we should show 80 // 81 $view_cat = ( !empty($_GET['cat']) && valid_int($_GET['cat']) ) ? $_GET['cat'] : 0; 82 83 // 84 // Get the forums and categories out of the database 85 // 86 $result = $db->query("SELECT f.id, f.name, f.descr, f.status, f.topics, f.posts, f.auth, f.hide_mods_list, c.id AS cat_id, c.name AS cat_name, t.topic_title, t.last_post_id, t.count_replies, p.poster_id, p.poster_guest, p.post_time, u.displayed_name AS poster_name, u.level AS poster_level FROM ( ( ( ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."topics t ON f.last_topic_id = t.id ) LEFT JOIN ".TABLE_PREFIX."posts p ON t.last_post_id = p.id ) LEFT JOIN ".TABLE_PREFIX."members u ON p.poster_id = u.id ), ".TABLE_PREFIX."cats c WHERE f.cat_id = c.id ORDER BY c.sort_id ASC, c.name ASC, f.sort_id ASC, f.name ASC"); 87 88 $categories = array(); 89 $forums = array(); 90 $forum_ids = array(); 91 while ( $forumdata = $db->fetch_result($result) ) { 92 93 if ( $functions->auth($forumdata['auth'], 'view', $forumdata['id']) ) { 94 95 if ( !array_key_exists($forumdata['cat_id'], $categories) ) 96 $categories[$forumdata['cat_id']] = 1; 97 else 98 $categories[$forumdata['cat_id']]++; 99 $forums[] = $forumdata; 100 $forum_ids[] = $forumdata['id']; 101 102 } 103 104 } 105 106 if ( !count($forums) ) { 107 108 // 109 // There were no viewable forums. 110 // Show this notice 111 // 112 $template->parse('msgbox', 'global', array( 113 'box_title' => $lang['Note'], 114 'content' => $lang['NoViewableForums'] 115 )); 116 117 } elseif ( $functions->get_config('single_forum_mode') && count($forums) === 1 ) { 118 119 // 120 // If this is the only (viewable) forum and the forum has been set up 121 // to kick the user to this only (viewable) forum ... 122 // 123 $functions->redirect('forum.php', array('id' => $forums[0]['id'])); 124 125 } else { 126 127 // 128 // Get all the moderators 129 // 130 $result = $db->query("SELECT m.forum_id, u.id, u.displayed_name, u.level FROM ".TABLE_PREFIX."moderators m, ".TABLE_PREFIX."members u WHERE m.forum_id IN(".join(', ', $forum_ids).") AND m.user_id = u.id ORDER BY u.displayed_name"); 131 $all_mods = $mods_per_forum = array(); 132 while ( $mods_data = $db->fetch_result($result) ) { 133 134 if ( !array_key_exists($mods_data['forum_id'], $mods_per_forum) ) 135 $mods_per_forum[$mods_data['forum_id']] = 1; 136 else 137 $mods_per_forum[$mods_data['forum_id']]++; 138 139 $all_mods[] = $mods_data; 140 141 } 142 foreach ( $forum_ids as $forum_id ) { 143 144 if ( !array_key_exists($forum_id, $mods_per_forum) ) 145 $mods_per_forum[$forum_id] = 0; 146 147 } 148 149 $template->parse('header', 'forumlist'); 150 151 $seen_forums = array(); 152 153 // 154 // Loop through the forums 155 // 156 foreach ( $forums as $forumdata ) { 157 158 // 159 // Which forum in the current category is this? 160 // 161 if ( empty($seen_forums[$forumdata['cat_id']]) ) 162 $seen_forums[$forumdata['cat_id']] = 1; 163 else 164 $seen_forums[$forumdata['cat_id']]++; 165 166 if ( $seen_forums[$forumdata['cat_id']] === 1 ) { 167 168 // 169 // If we didn't parse this category yet, than do it now 170 // 171 $template->parse('cat_header', 'forumlist', array( 172 'cat_name' => unhtml(stripslashes($forumdata['cat_name'])), 173 'cat_url' => $functions->make_url('index.php', array('cat' => $forumdata['cat_id'])).'#cat'.$forumdata['cat_id'], 174 'cat_anchor' => 'cat'.$forumdata['cat_id'] 175 )); 176 177 } 178 179 if ( !$view_cat || $forumdata['cat_id'] == $view_cat ) { 180 181 // 182 // Output this forum if no category or the category 183 // this forum is in has been chosen 184 // 185 186 if ( $forumdata['topics'] ) { 187 188 $last_topic_title_full = ''; 189 $last_topic_title = unhtml($functions->replace_badwords(stripslashes($forumdata['topic_title']))); 190 191 $rtrim_topic = $template->get_config('forumlist_topic_rtrim_length'); 192 if ( is_int($rtrim_topic) && entities_strlen($last_topic_title) > $rtrim_topic ) { 193 194 $last_topic_title_full = $last_topic_title; 195 $last_topic_title = entities_rtrim($last_topic_title, $rtrim_topic).'...'; 196 197 } 198 if ( $forumdata['count_replies'] ) { 199 200 $last_topic_title_full = ( !empty($last_topic_title_full) ) ? $lang['Re'].' '.$last_topic_title_full : ''; 201 $last_topic_title = $lang['Re'].' '.$last_topic_title; 202 203 } 204 205 $author = ( $forumdata['poster_id'] ) ? $functions->make_profile_link($forumdata['poster_id'], $forumdata['poster_name'], $forumdata['poster_level']) : unhtml(stripslashes($forumdata['poster_guest'])); 206 $last_topic_title_full = ( !empty($last_topic_title_full) ) ? ' title="'.$last_topic_title_full.'"' : ''; 207 208 } 209 210 list($forum_icon, $forum_status) = $functions->forum_icon($forumdata['id'], $forumdata['status'], $forumdata['post_time']); 211 212 $template->parse('forum', 'forumlist', array( 213 'forum_icon' => $forum_icon, 214 'forum_status' => $forum_status, 215 'forum_name' => '<a href="'.$functions->make_url('forum.php', array('id' => $forumdata['id'])).'">'.unhtml(stripslashes($forumdata['name'])).'</a>', 216 'forum_descr' => stripslashes($forumdata['descr']), 217 'forum_mods' => ( $mods_per_forum[$forumdata['id']] >= 1 && !$forumdata['hide_mods_list'] ) ? sprintf($lang['ModeratorList'], $functions->get_mods_list($forumdata['id'], $all_mods)) : '', 218 'total_topics' => $forumdata['topics'], 219 'total_posts' => $forumdata['posts'], 220 'author_date' => ( $forumdata['topics'] ) ? sprintf($lang['AuthorDate'], $author, $functions->make_date($forumdata['post_time'])) : '-', 221 'by_author' => ( $forumdata['topics'] ) ? sprintf($lang['ByAuthor'], $author) : '-', 222 'on_date' => ( $forumdata['topics'] ) ? sprintf($lang['OnDate'], $functions->make_date($forumdata['post_time'])) : '-', 223 'lp_author' => ( $forumdata['topics'] ) ? $author : '-', 224 'lp_date' => ( $forumdata['topics'] ) ? $functions->make_date($forumdata['post_time']) : '-', 225 'latest_post' => ( $forumdata['topics'] ) ? '<a href="'.$functions->make_url('topic.php', array('post' => $forumdata['last_post_id'])).'#post'.$forumdata['last_post_id'].'"'.$last_topic_title_full.' rel="nofollow">'.$last_topic_title.'</a>' : $lang['NoPosts'] 226 )); 227 228 } 229 230 if ( $seen_forums[$forumdata['cat_id']] === $categories[$forumdata['cat_id']] ) { 231 232 // 233 // If we didn't parse this category footer yet, than do it now 234 // 235 $template->parse('cat_footer', 'forumlist', array( 236 'cat_name' => unhtml(stripslashes($forumdata['cat_name'])), 237 'cat_url' => $functions->make_url('index.php', array('cat' => $forumdata['cat_id'])).'#cat'.$forumdata['cat_id'], 238 'cat_anchor' => 'cat'.$forumdata['cat_id'] 239 )); 240 241 } 242 243 } 244 245 // 246 // Parse the forumlist footer 247 // 248 $template->parse('footer', 'forumlist'); 249 250 } 251 252} 253 254$functions->forum_stats_box(); 255 256// 257// Include the page footer 258// 259require(ROOT_PATH.'sources/page_foot.php'); 260 261?>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問