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

비회원 전용 컨텐츠 페이지 만들기

· 6년 전 · 4217 · 2

컨텐츠 페이지에 비회원일때만 보이는 입력창을 만들어 봅니다.


1. / adm / contentform.php 

1-1. 디비 필드 추가
상단 적당한 위치에 디비 필드 생성을 위한 아래 내용 추가

// 데이타2개 더 입력가능하게 필드 생성 - 해피정닷컴 2019-11-08
if(!sql_query(" select co_content2 from {$g5['content_table']} limit 1 ", false)) {
    $sql = " ALTER TABLE `{$g5['content_table']}`  ADD `co_content2` text ,
                                                    ADD `co_mobile_content2` text ";
    sql_query($sql, false);
}


1-2. 적당한 위치에 아래 내용 추가

    <tr>
        <th scope="row">PC 내용 (비회원전용)</th>
        <td><?php echo editor_html('co_content2', get_text($co['co_content2'], 0)); ?></td>
    </tr>
    <tr>
        <th scope="row">모바일 내용 (비회원전용)</th>
        <td><?php echo editor_html('co_mobile_content2', get_text($co['co_mobile_content2'], 0)); ?></td>
    </tr>


1-3. 하단 자바스크립트 영역에 내용추가

    <?php echo get_editor_js('co_content2'); ?>
    <?php echo get_editor_js('co_mobile_content2'); ?>


2. / adm / contentformupdate.php
$sql_common 에 아래 내용 추가

                co_content2         = '$co_content2',
                co_mobile_content2  = '$co_mobile_content2',


3. / bbs / content.php

$str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']);

를 아래와 같이 변경합니다.

if ($co['co_content2'] && $member['mb_level']<2) { //비회원
$str = conv_content($co['co_content2'], $co['co_html'], $co['co_tag_filter_use']);
} else {
$str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']);
}


4. / mobile / content.php
$co_content = $co['co_mobile_content'] ? $co['co_mobile_content'] : $co['co_content'];
$str = conv_content($co_content, $co['co_html'], $co['co_tag_filter_use']);

를 아래와 같이 변경

if ($co['co_mobile_content2'] && $member['mb_level']<2) { //비회원
$co_content = $co['co_mobile_content2'] ? $co['co_mobile_content2'] : $co['co_content2'];
} else {
$co_content = $co['co_mobile_content'] ? $co['co_mobile_content'] : $co['co_content'];
}
$str = conv_content($co_content, $co['co_html'], $co['co_tag_filter_use']);

댓글 작성

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

로그인하기

댓글 2개

6년 전
유용한 정보 감사드립니다.
6년 전
좋은 정보 감사합니다.

게시글 목록

번호 제목
23966
23963
23953
23949
23938
23935
23933
23928
23919
23918
23917
23910
23902
23901
23897
23894
23893
23891
23885
23872
23870
23862
23859
23853
23845
23838
23827
23819
23805
23801