테스트 사이트 - 개발 중인 베타 버전입니다

수정가능한 컨텐츠만들기

· 10년 전 · 7111
내용관리가 있지만 레이아웃이 다르거나 일부내용만 수정해야할때 사용하시면 됩니다

head.php 나 head_sub.php 적당한곳에 넣어주세요

[code]
function we_content($c_id)
{
$c_id_centent = sql_fetch("select * from g5_content where co_id = '$c_id' ");
echo $c_id_centent[co_content];
}
[/code]

컨텐츠를 넣을 곳에

[code]
<?=we_content('컨텐츠 아이디')?>
[/code]

를 넣어주시면됩니다.

adm/contentformupdate.php

72번줄
[code]
goto_url("./contentform.php?w=u&amp;co_id=$co_id");
[/code]



[code]
if ($k=="k") {
goto_url("./notice.php?w=u&amp;co_id=$co_id");
} else {
goto_url("./contentform.php?w=u&amp;co_id=$co_id");
}
[/code]

이렇게 변경해주시고,

adm/notice.php 를 만드셔서

[code]
<?php
$sub_menu = '400100';
include_once('./_common.php');
include_once(G5_EDITOR_LIB);

auth_check($auth[$sub_menu], "w");

// 상단, 하단 파일경로 필드 추가
if(!sql_query(" select co_include_head from {$g5['content_table']} limit 1 ", false)) {
$sql = " ALTER TABLE `{$g5['content_table']}` ADD `co_include_head` VARCHAR( 255 ) NOT NULL ,
ADD `co_include_tail` VARCHAR( 255 ) NOT NULL ";
sql_query($sql, false);
}

// html purifier 사용여부 필드
if(!sql_query(" select co_tag_filter_use from {$g5['content_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['content_table']}`
ADD `co_tag_filter_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `co_content` ", true);
sql_query(" update {$g5['content_table']} set co_tag_filter_use = '1' ");
}

// 모바일 내용 추가
if(!sql_query(" select co_mobile_content from {$g5['content_table']} limit 1", false)) {
sql_query(" ALTER TABLE `{$g5['content_table']}`
ADD `co_mobile_content` longtext NOT NULL AFTER `co_content` ", true);
}

// 스킨 설정 추가
if(!sql_query(" select co_skin from {$g5['content_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['content_table']}`
ADD `co_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_mobile_content`,
ADD `co_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_skin` ", true);
sql_query(" update {$g5['content_table']} set co_skin = 'basic', co_mobile_skin = 'basic' ");
}

$html_title = "내용";
$g5['title'] = $html_title.' 관리';

if ($w == "u")
{
$html_title .= " 수정";
$readonly = " readonly";

$sql = " select * from {$g5['content_table']} where co_id = '$co_id' ";
$co = sql_fetch($sql);
if (!$co['co_id'])
alert('등록된 자료가 없습니다.');
}
else
{
$html_title .= ' 입력';
$co['co_html'] = 2;
$co['co_skin'] = 'basic';
$co['co_mobile_skin'] = 'basic';
}

include_once (G5_ADMIN_PATH.'/admin.head.php');
?>

<form name="frmcontentform" action="./contentformupdate.php" onsubmit="return frmcontentform_check(this);" method="post" enctype="MULTIPART/FORM-DATA" >
<input type="hidden" name="k" value="k">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="co_html" value="1">

<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="co_id">ID</label></th>
<td>
<?php echo help('20자 이내의 영문자, 숫자, _ 만 가능합니다.'); ?>
<input type="text" value="<?php echo $co['co_id']; ?>" name="co_id" id ="co_id" required <?php echo $readonly; ?> class="required <?php echo $readonly; ?> frm_input" size="20" maxlength="20">
<?php if ($w == 'u') { ?><a href="<?php echo G5_BBS_URL; ?>/content.php?co_id=<?php echo $co_id; ?>" class="btn_frmline">내용확인</a><?php } ?>
</td>
</tr>
<tr>
<th scope="row"><label for="co_subject">제목</label></th>
<td><input type="text" name="co_subject" value="<?php echo htmlspecialchars2($co['co_subject']); ?>" id="co_subject" required class="frm_input required" size="90"></td>
</tr>
<tr>
<th scope="row">내용</th>
<td><?php echo editor_html('co_content', get_text($co['co_content'], 0)); ?></td>
</tr>

</tbody>
</table>
</div>

<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./contentlist.php">목록</a>
</div>

</form>

<script>
function frmcontentform_check(f)
{
errmsg = "";
errfld = "";

<?php echo get_editor_js('co_content'); ?>
<?php echo chk_editor_js('co_content'); ?>
<?php echo get_editor_js('co_mobile_content'); ?>

check_field(f.co_id, "ID를 입력하세요.");
check_field(f.co_subject, "제목을 입력하세요.");
check_field(f.co_content, "내용을 입력하세요.");

if (errmsg != "") {
alert(errmsg);
errfld.focus();
return false;
}
return true;
}
</script>

<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

[/code]

이 코드를 넣어주시면됩니다.
관리자 메뉴 추가는

[code]
array('402100', '제목', ''.G5_ADMIN_URL.'/notice.php?w=u&co_id=컨텐츠 아이디', 'bbs_board'),
[/code]

이 형태로 추가해주시면 됩니다.


납품해서 고객이 수정해야한다거나.. 수정이 번거로울 때 사용하시면될듯하네요
보통은 내용관리로 사용하셔도됩니다~


p.s 내용관리에서 먼저 컨텐츠를 만들어야 한다는 단점이 있습니다.. 귀찮아서 아직 그 부분은 만들지 않았네요 ㅠ

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
24318
24317
24315
24309
24294
24293
24277
24262
24260
24253
24251
24236
24233
24228
24226
24221
24214
24203
24201
24199
24196
24195
24194
24192
24191
24187
24185
24183
24172
24168