게시판 유튜브 영상 3개 게시
본문
게시판에 유튜브 링크를 넣으면 보여지게 했습니다.
링크는 총 4개이지만 wr_link1은 다른 pdf입니다.
유튜브만 총 3개(wr_link2,3,4)를 넣으려했고 1개는 보이는데 나머지 2개가 안보입니다..
그누보드에 기본적으로 2개가 있었어서 유튜브 1개는 보이는건지..
wr_link있는곳은 다 추가 했는데 어떤 오류인지 파악이 안됩니다ㅠㅠ 도와주십쇼
view.skin.php입니다.
<div class="v_con_wrap spec_wrap">
<p class="title">동영상</p>
<div class="con_desc">
<div class="video-container">
<?php
function extractYouTubeID($url) {
if (preg_match('/youtu\.be\/([^\&\?\/]+)/', $url, $matches)) {
return $matches[1];
} elseif (preg_match('/youtube\.com\/.*v=([^\&\?\/]+)/', $url, $matches)) {
return $matches[1];
} elseif (preg_match('/youtube\.com\/embed\/([^\&\?\/]+)/', $url, $matches)) {
return $matches[1];
}
return null;
}
$youtubeLinks = ['wr_link2', 'wr_link3', 'wr_link4'];
foreach ($youtubeLinks as $link) {
if (!empty($view[$link])) {
$youtubeID = extractYouTubeID($view[$link]);
if ($youtubeID) {
echo '<div class="youtubebx"><iframe src="https://www.youtube.com/embed/' . $youtubeID . '" frameborder="0" allowfullscreen></iframe></div>';
} else {
echo '유효한 유튜브 링크를 입력해주세요.';
}
}
}
?>
</div><!-- video-container -->
</div><!-- con_desc -->
</div><!-- v_con_wrap spec_wrap -->
write_update.php 일부입니다.
$wr_link1 = '';
if (isset($_POST['wr_link1'])) {
$wr_link1 = substr($_POST['wr_link1'],0,1000);
$wr_link1 = trim(strip_tags($wr_link1));
$wr_link1 = preg_replace("#[\\\]+$#", "", $wr_link1);
}
$wr_link2 = '';
if (isset($_POST['wr_link2'])) {
$wr_link2 = substr($_POST['wr_link2'],0,1000);
$wr_link2 = trim(strip_tags($wr_link2));
$wr_link2 = preg_replace("#[\\\]+$#", "", $wr_link2);
}
$wr_link3 = '';
if (isset($_POST['wr_link3'])) {
$wr_link3 = substr($_POST['wr_link3'],0,1000);
$wr_link3 = trim(strip_tags($wr_link3));
$wr_link3 = preg_replace("#[\\\]+$#", "", $wr_link3);
}
$wr_link4 = '';
if (isset($_POST['wr_link4'])) {
$wr_link4 = substr($_POST['wr_link4'],0,1000);
$wr_link4 = trim(strip_tags($wr_link4));
$wr_link4 = preg_replace("#[\\\]+$#", "", $wr_link4);
}
$sql = " insert into $write_table
set wr_num = " . ($w == 'r' ? "'$wr_num'" : "(SELECT IFNULL(MIN(wr_num) - 1, -1) FROM $write_table as sq) ") . ",
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$wr_option',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_seo_title = '$wr_seo_title',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link3 = '$wr_link3',
wr_link4 = '$wr_link4',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_link3_hit = 0,
wr_link4_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '{$member['mb_id']}',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10 = '$wr_10' ";
sql_query($sql);
$sql = " update {$write_table}
set ca_name = '{$ca_name}',
wr_option = '{$wr_option}',
wr_subject = '{$wr_subject}',
wr_content = '{$wr_content}',
wr_seo_title = '$wr_seo_title',
wr_link1 = '{$wr_link1}',
wr_link2 = '{$wr_link2}',
wr_link3 = '{$wr_link3}',
wr_link4 = '{$wr_link4}',
mb_id = '{$mb_id}',
wr_name = '{$wr_name}',
wr_email = '{$wr_email}',
wr_homepage = '{$wr_homepage}',
wr_1 = '{$wr_1}',
wr_2 = '{$wr_2}',
wr_3 = '{$wr_3}',
wr_4 = '{$wr_4}',
wr_5 = '{$wr_5}',
wr_6 = '{$wr_6}',
wr_7 = '{$wr_7}',
wr_8 = '{$wr_8}',
wr_9 = '{$wr_9}',
wr_10= '{$wr_10}'
{$sql_ip}
{$sql_password}
where wr_id = '{$wr['wr_id']}' ";
sql_query($sql);
!-->
답변 1
그누보드 게시판의 기본 컬럼은 wr_link1, wr_link2까지 밖에 없습니다,
db에서 wr_link3, wr_link4 컬럼은 추가하셨나요?
해당 내용 먼저 확인해보세요!
답변을 작성하시기 전에 로그인 해주세요.