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

'내가남긴댓글'에 어디에 남겼는지 확인이 가능하게

· 17년 전 · 4030 · 3
'내토크',' 내가남긴댓글'을 클릭해 보면 내가 어디에다 남기 댓글인지 확인이 되지 않습니다. 그래서....

1. g4/admin/talk/upgrade.php

sql_query("CREATE TABLE `{$g4['talk_comment_table']}` (  `t_id` int(11) NOT NULL default '0',  `id` int(11) NOT NULL default '0',  `num` int(11) NOT NULL auto_increment,  `mb_id` varchar(30) NOT NULL default '',  `name` varchar(30) NOT NULL default '',  `secret` tinyint(4) NOT NULL default '0',  `content` tinytext NOT NULL,  `regdate` datetime NOT NULL default '0000-00-00 00:00:00',  PRIMARY KEY  (`num`),  KEY `mb_id` (`mb_id`),  KEY `id` (`id`),  KEY `t_id` (`t_id`)) TYPE=MyISAM", false);

`tname` varchar(30) NOT NULL default '', 를 추가합니다. 그냥 아래부분을 덮어 써도 됩니다.

sql_query("CREATE TABLE `{$g4['talk_comment_table']}` (  `t_id` int(11) NOT NULL default '0',  `id` int(11) NOT NULL default '0',  `num` int(11) NOT NULL auto_increment,  `mb_id` varchar(30) NOT NULL default '',   `tname` varchar(30) NOT NULL default '', `name` varchar(30) NOT NULL default '',  `secret` tinyint(4) NOT NULL default '0',  `content` tinytext NOT NULL,  `regdate` datetime NOT NULL default '0000-00-00 00:00:00',  PRIMARY KEY  (`num`),  KEY `mb_id` (`mb_id`),  KEY `id` (`id`),  KEY `t_id` (`t_id`)) TYPE=MyISAM", false);




2. g4/talk/mytalk_comment_update.php에서

        // t_id 구함, 친구목록에서 댓글을 등록 경우  t_id 문제
        $res = sql_fetch("select * from {$g4['talk_table']} where id='{$id}'");
        if (empty($res))
            err_xml('존재하지 않는 토크입니다.');
        else
            $t_id = $res['t_id'];
            
        // 댓글은 희망       
        $sql = "insert into {$g4['talk_comment_table']} set t_id='{$t_id}', id='{$id}', mb_id='{$member['mb_id']}', name='{$member['mb_name']}', secret='{$secret}', content='{$talk_content}', regdate='{$g4['time_ymdhis']}'";

에 $tname 부분을 추가. 아래 것으로 변경

        // t_id 구함, 친구목록에서 댓글을 등록 경우  t_id 문제
        $res = sql_fetch("select * from {$g4['talk_table']} where id='{$id}'");
        if (empty($res))
            err_xml('존재하지 않는 토크입니다.');
        else
            $t_id = $res['t_id'];
            $tname = $res['name']; //nick을 원하면 nick으로 변경.
            
        // 댓글은 희망       
        $sql = "insert into {$g4['talk_comment_table']} set t_id='{$t_id}', id='{$id}', tname='{$tname}', mb_id='{$member['mb_id']}', name='{$member['mb_name']}', secret='{$secret}', content='{$talk_content}', regdate='{$g4['time_ymdhis']}'";


3. g4/talk/mytalk_recent_comment_get.php

    $regdate = "<a href=\"mytalk.php?t_id={$t_id}&id={$id}\">{$regdate}</a>";
밑에
    $tname = "<a href=\"mytalk.php?t_id={$t_id}&id={$id}\">{$tname}</a>";
추가

아래부분의 $xml 부분에 아래줄을 추가

    $xml .= "<tname><![CDATA[{$tname}]]></tname>\n";


4. g4/skin/talk/본인skin 의 style.css

맨 아래 recent_comment 부분에 추가

.recent_comment_tname { width:110px; font-size:12px; color:#ccc; }


5. g4/js/talk.js

맨밑 부분에

        // xml 데이터 파싱
        get_id      = item[i].getElementsByTagName('id')[0].firstChild.nodeValue;
밑에

        get_tname   = item[i].getElementsByTagName('tname')[0].firstChild.nodeValue;
추가

그 아래 부분에

        print += '<td class="recent_comment_name">' + get_name + '</td>';
밑에
        print += '<td class="recent_comment_tname"><b>' + get_tname + '</b>님의 토크에</td>';
를추가
        print += '<td class="recent_comment_regdate">' + get_regdate + '</td>';
를 수정
        print += '<td class="recent_comment_regdate">' + get_regdate + '에 등록</td>';



수정 후 토크관리에서 업그레이드를 먼저 하세요.
업그레이드 후 tname 관련 DB가 안만들어지면 알아서 만들어 주세요.

댓글 작성

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

로그인하기

댓글 3개

따라했습니다만 댓글을 올리면 땡그르 돌다가 아무것도 보이지 않는다는.... 그래시 다시 예전으로 돌렸습니다.
원인을 알수 없습니다.
맨 아래줄에

수정 후 토크관리에서 업그레이드를 먼저 하세요.
업그레이드 후 tname 관련 DB가 안만들어지면 알아서 만들어 주세요.

1번을 수정한 후 관리자페이지에서 업그레이드를 한 후에 다음 것들을 하셔야 합니다.

1번을 보시면
`tname` varchar(30) NOT NULL default '',
를 참조해서

talk_comment_table 에 tname과 관련한 DB를 추가 해 주셔야 합니다.

DB를 확인 해 보세요.
15년 전
잘 됩니다. 감사^^