채택완료

그룹최신글 질문드립니다.. 답변좀 부탁드려요

2014-01-20 (월) 16:35:50 5,002
그룹최신글 함수 적용해서 불러오는것 까지는 되었는데요..
링크시 각각의 게시판으로 링크가 안되요.. 고수님 도와주세요
 
최신글 함수-팁자료실에서 보고 적용했어요
Copy
<?if (!defined('_GNUBOARD_')) exit;// 함수 정의 시작
// 최신글 추출 - 선택한 그룹별로 원하는 게시판을 제외하고 원하는 수만큼 보여줌function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $no_table="", $category="", $orderby=""){ global $config; global $g4;
 $list = array(); $limitrows = $rows;
 $sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' ";
 // 제거할 테이블들 if ($no_table) {  $t_flag = serialize($no_table);  if ($t_flag[0] == "a") { //Array이면   for ($ic=0; $ic<count($no_table); $ic++) {    $sqlgroup .= " and bo_table != '$no_table[$ic]' ";   }  } else if ($t_flag[0] == "s") { //String이면   $sqlgroup .= " and bo_table != '$no_table' ";  } }
 $sqlgroup .= " and bo_use_search=1 order by bo_order_search "; $rsgroup = sql_query($sqlgroup);
 if ($skin_dir)  $latest_skin_path = "$g4[path]/skin/latest/$skin_dir"; else  $latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
 for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {  $bo_table = $rowgroup[bo_table];
  // 테이블 이름구함  $sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";  $board = sql_fetch($sql);
  $tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 실제이름
  // 옵션에 따라 정렬  $sql = "select * from $tmp_write_table where wr_is_comment = 0 ";  $sql .= (!$category) ? "" : " and ca_name = '$category' ";  $sql .= (!$orderby) ? "  order by wr_id desc " : "  order by $orderby desc, wr_id desc ";  $sql .= " limit $limitrows";
  $result = sql_query($sql);
  for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
   if(!$orderby) $op_list[$k] = $row[wr_datetime];   else  {    $op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);    $op_list[$k] .= $row[wr_datetime];   }
   $list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
   $list[$k][bo_table] = $board[bo_table];   $list[$k][bo_subject] = $board[bo_subject];
   $list[$k][bo_wr_subject] = cut_str($board[bo_subject] . $list[$k][wr_subject], $subject_len);  } } if($k>0) array_multisort($op_list, SORT_DESC, $list); if($k>$rows) array_splice($list, $rows);
 ob_start(); include "$latest_skin_path/latest.skin.php"; $content = ob_get_contents(); ob_end_clean(); return $content;}/// 함수 정의 끝?>
 
 
최신글 소스 lastet.skin.php
Copy
<?if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
if(!$options) $options=3;
$cols  = "1"; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)$image_h  = 0; // 이미지 상하 간격
$col_width = (int)(99 / $cols);
$thumb_path = $data_path.'/thumb';?>
<style>.add_font_03 {font-size:13px; line-height:20px; }.add_font_03 a {font:12px "NanumGothic", "RixGoB"; color:#777575;text-decoration:none; line-height:20px; }.add_font_03 a:hover {color:#07a8e6;text-decoration:underline; line-height:20px; }
.main1_font_03 {font-size:12px; line-height:20px; color:#3d8d91;}.main1_font_03 a {"NanumGothic", "RixGoB"; color:#3d8d91; text-decoration:none; line-height:20px; }.main1_font_03 a:hover {color:#666666; text-decoration:underline; line-height:20px; }</style>
<table width=100% border=0  valign="middle"  cellpadding=0 cellspacing=0  style="padding-top:8px;">
  <tr>     <td valign="middle"  >   <!--타이틀-->     <table width="100%" border="0" cellpadding="0" cellspacing="0">        <tr>          <td valign="top" >        <table width=100% border=0  cellpadding=0 cellspacing=0>              <tr>                 <td valign="middle" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <!-- 이미지보이는 부분 시작 -->    <table  cellpadding="0" cellspacing="0" width="100%" border="0">    <tr><td>
       <table width="98%" border="0" cellspacing="0" cellpadding="0">        <tr><td ></td></tr>        <tr>         <td >          <table width="98%" border="0" cellspacing="0" cellpadding="0">            <tr>
           <? for ($i=0; $i<count($list); $i++) {              if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }            ?> 
           <td width="<?=$col_width?>%" valign='top'>
           <?           $image = $list[$i][file][0][file]; //원본           $img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력           $thumb = $thumb_path. "/". $list[$i][wr_id];
             if ( file_exists($thumb) )            $img = $thumb;                         $style = "";            if ($list[$i][icon_new]) {            }              $subject = "$list[$i][subject]"; //제목 글자수 자르기            $wr_hit  = $list[$i]['wr_hit'];            $wr_id  = $list[$i]['wr_id'];           //    if ($list[$i]['comment_cnt']) //코           //        $cmt = "({$list[$i]['comment_cnt']})";
            $bg = "";  //새글?             if ($list[$i][icon_new])             $bg="la_top_2.gif";             else             $bg="la_top_1.gif";
             echo $list[$i][icon_reply] . " ";
             echo "<table cellpadding='0' cellspacing='0' border='0'>               <tr>               <td  valign='top' width='98%' align='left' style='padding-top:0px; padding-left:20px;'><span class='add_font_03'><span class='main1_font_03' >[{$list[$i]['ca_name']}]</span>&nbsp;<a href=\"$g4[bbs_path]/board.php?bo_table=$board[bo_table]&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">".cut_str(strip_tags($list[$i][wr_subject]),61,"…")."</a> </span></td>                </tr>                                       <tr>                <td align='center'  style=' padding-left:1px;'><img src='{$g4['path']}/image/bord_line.png' width='330'></td>                                                       </tr>             </table>";           ?>           </td>           <? } ?>            <?            $cnt = ($i%$cols);            for ($k=$cnt; $k<$cols && $cnt; $k++) {             echo "<td width=$col_width%>&nbsp;</td>";            }            ?>             <? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>             <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>            </tr>          </table>         </td>        </tr>       </table>    </td></tr>    </table>    <!-- 이미지보이는 부분 끝 -->                                  </table>      </table>  <tr>   </tr></table>
 
 
저희사이트
두번째줄 광고란부분에 적용했습니다.
 
부탁드립니다. 몇날을 찾고 해메도 디자이너라서 그런지  
코드 머리가 안돌아가요.ㅠㅠ
 
 
|

답변 5개 / 댓글 1개

채택된 답변
+20 포인트
2014-01-21 (화) 19:27:09
Copy
<td valign='top' width='98%' align='left' style='padding-top:0px; padding-left:20px;'><span class='add_font_03'><span class='main1_font_03' >[{$list[$i]['ca_name']}]</span>&nbsp;<a href=\"{$list[$i]['href']}&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">".cut_str(strip_tags($list[$i][wr_subject]),61,"…")."</a> </span></td>
 
이렇게 수정하니까 됐어요..ㅎㅎㅎ
 

많은 도움이 되었습니다. 감사합니다.

2014-01-21 (화) 09:59:36
답변주셔서 감사합니다.

바꿔봤는데요.. 다른 글도 안들어가져요..

array [bo_table] 로 주소가 잡혀요....ㅠㅠ


2014-01-20 (월) 17:17:14
맨아래글은 다른 게시판인데 제대로 안가요 ㅠㅠ

답변에 대한 댓글 1개

[code]
<td valign='top' width='98%' align='left' style='padding-top:0px; padding-left:20px;'><span class='add_font_03'><span class='main1_font_03' >[{$list[$i]['ca_name']}]</span>&nbsp;<a href=\"$g4[bbs_path]/board.php?bo_table=$board[bo_table]&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">".cut_str(strip_tags($list[$i][wr_subject]),61,"…")."</a> </span></td>
[/code]

아래 문서에서 중간에 이 부분을요..

[code]
<td valign='top' width='98%' align='left' style='padding-top:0px; padding-left:20px;'><span class='add_font_03'><span class='main1_font_03' >[{$list[$i]['ca_name']}]</span>&nbsp;<a href=\"$g4[bbs_path]/board.php?bo_table=$list[$i][bo_table]&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">".cut_str(strip_tags($list[$i][wr_subject]),61,"…")."</a> </span></td>
[/code]

이렇게 바꿔보세요.. bo_table 값이 잘못 들어가있네요./
누르면 해당글로 가는데요..


[]안에 들어가있는 카테고리명 누르면 해당되는 글만 보이는거 말씀하시는건가요..

답변을 작성하려면 로그인이 필요합니다.