여기에서 글자수 제한할수도 있나요?? > 자유게시판

자유게시판

여기에서 글자수 제한할수도 있나요?? 정보

여기에서 글자수 제한할수도 있나요??

본문

그누보드 질문은 아니구요.. 제가 만든건 아닌데 분석할려니
프로그래머가 아니라 힘드네영 ㅠㅠ
여기에서 어떤 구문은 집어넣고 어떤구문을 수정해야 ".$goods->row[goods_name]." << 이것의
글자수가 제한되어 나오는지 도저히 알고 싶어서요 >_<

<?php
    $title = new my_db_no_obj($shoesmoa);
    $goods = new my_db_no_obj($shoesmoa);
    $sMALL_GOODS = new my_db_obj(HOST_MALL_GOODS, DBNAME_MALL_GOODS);
    $sMALL_EXBUY = new my_db_obj(HOST_MALL_EXBUY, DBNAME_MALL_EXBUY);
    $sGoods    = new my_db_no_obj($sMALL_GOODS);
       
    # $Bcode가 없으면 슈즈( Shoes )로 설정
    if( $Bcode == "" ) $Bcode = "Shoes";
   
    # 메인 추천상품 타이틀 정보 가져오기 ----------------------------------------------------------
    $sQuery = " SELECT  number
                ,       title
                ,       goods_etc
                ,       td_limit
                ,       title_image
                FROM    main_best_title
                WHERE   bc_code = '".$Bcode."'
                AND     main_ok = 'Y'
                ORDER BY position_number";
    $title->qstr = $sQuery;
    $title->my_query();

    # 쿠폰 함수 -----------------------------------------------------------------------------------
    function getCouponFlag($pGoodsNumber,$pA_Flag,$pSaleCost){
        GLOBAL $sGoods, $sMALL_GOODS, $sMALL_EXBUY;
        $vFlag  = "F";
        $nowTime = time();

        # agnet_goods_flag
        if( $pA_Flag == "W"){ $mgc_code = new my_db_no_obj($sMALL_EXBUY); }
        else                { $mgc_code = new my_db_no_obj($sMALL_GOODS); }

        $sQuery = " SELECT number
                    ,      coupon_number
                    FROM   mall_goods_coupon_code
                    WHERE  coupon_code = '".$pGoodsNumber."' ";
        //echo $sQuery;
        $mgc_code->qstr = $sQuery;
        $mgc_code->my_query_fetch();

        if( $mgc_code->rows == 0 ){
            $coupon['flag']  = "F";
        }else{
            //echo "2";
            $sQuery = " SELECT      number
                        ,           coupon_cost
                        ,           coupon_flag
                        FROM        mall_goods_coupon
                        WHERE       number = '".$mgc_code->row[coupon_number]."'
                        AND         coupon_date_flag = 'T'
                        AND         coupon_ok = 'Y'
                        AND         coupon_s_date <= ".$nowTime."
                        AND         coupon_e_date >= ".$nowTime;
            //echo $sQuery;
            $sGoods->qstr = $sQuery;
            $sGoods->my_query_fetch();
            $coupon['foint'] = "style='position: relative;z-index:-1;'";
            $coupon['div']   = "<div id='apDiv1' style='position:absolute;left:-42px;top:2px;width:102px;height:68px;'><img src='http://img.shoesmoa.co.kr/coupon/main_coupon_icon.png' border='0' class='png24'></div>";
            if( $sGoods->rows > 0 ){
                $coupon['flag']  = "T";
                if( $sGoods->row[coupon_flag] == "P" ){
                    $addCouponPersent = $sGoods->row[coupon_cost]; # 할인률
                    $addCouponCost    = $pSaleCost - ( ( $pSaleCost / 100 ) * $addCouponPersent );
                    $addCouponCost    = round ($addCouponCost, -2);
                }else{
                    $addCouponCost   = $pSaleCost - $sGoods->row[coupon_cost];
                }
                $coupon['coupon_cost'] = $addCouponCost;
            }else{
                $coupon['flag']  = "F";
            }
        }

        return $coupon;
    }
   
    # 특정입점업체 아이콘 노출
    function getEventIcon( $pAgent_user_id ){
        $pAgent = array(  "feel","cookie7","indastyle","kamp4012","holicbus" );
       
        $pIcon['flag']  = "F";
       
        for( $iLoop = 0; $iLoop < count($pAgent); $iLoop++ ){
            if( trim($pAgent_user_id) == $pAgent[$iLoop] ){
                $pIcon['foint'] = "style='position: relative;z-index:-1;'";
                $pIcon['div']   = "<div id='apDiv1' style='position:absolute;left:-35px;top:2px;width:102px;height:68px;'><img src='http://img.shoesmoa.co.kr/event1/img/gratitude.png' border='0' class='png24'></div>";
                $pIcon['flag']  = "T";
            }
        }

        return $pIcon;
    }
    # ---------------------------------------------------------------------------------------------
?>

<?

class StringSize{
    /* 페이지 기본 폰트 : 굴림체, 12px */
  
    var $SPECIAL = 6;    /* ASCII 문자중 특수문자(ASCII 코드 1~32) */
    var $MCHAR = 12;    /* 한글 문자 */
    var $BASE = 32;        /* ASCII 코드 하한값 */
    var $END =  127;    /* ASCII 코드 상한값 */
    var $ASCII = Array(
            4,4,4,6,6,10,8,4,5,5,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,6,
            4,4,8,6,8,6,12,8,8,9,8,8,7,9,8,3,6,8,7,11,9,9,8,9,8,8,
            8,8,8,10,8,8,8,6,11,6,6,6,4,7,7,7,7,7,3,7,7,3,3,6,3,11,
            7,7,7,7,4,7,3,7,6,10,7,7,7,6,6,6,9,6
    );
    function cut($str,$width){
        $str = strip_tags($str);
        $str = preg_replace("/ {2,}/"," ",$str);
        $str = preg_replace("/^ | $/","",$str);
        $len = strlen($str);
        if ($width < $len * $this->MCHAR){
            for($i=0;$i<$len;$i=$i+$charLen){
                $code = ord($str[$i]);
                if ($code <= $this->END){
                    $charSize     = $this->getAscSize($code);
                    $charLen    = 1;
                }
                else{
                    $charSize    = $this->MCHAR;
                    $charLen     = 2;
                }
                if ($charSize < $width)    $width -= $charSize;
                else            break;
            }
            return substr($str,0,$i);
        }
        return $str;
    }
    function getAscSize($code){
        if ($code < $this->BASE)    return $this->SPECIAL;
        else{
            $idx = $code - $this->BASE;
            return $this->ASCII[$idx];
        }
    }
}
#-----------------------------------글자수제한

?>
<table border='0' width='713' cellspacing='0' cellpadding='0' align='center' valign='top'>
<?php
    for( $iLoop = 0; $iLoop < $title->rows; $iLoop++ ) {
        $title->my_fetch();
        $title_number = $title->row[number];      # 타이틀 number값
        $title_name   = $title->row[title];       # 타이틀명
        $goods_etc    = $title->row[goods_etc];   # 전체 보여줄 상품 수
        $td_limit     = $title->row[td_limit];    # 한줄에 보여줄 상품 수
        $title_image  = $title->row[title_image]; # 타이틀 이미지
       
        # 추천상품 가져오기 -----------------------------------------------------------------------
        $sQuery = " SELECT  mall_goods.*
                    FROM    main_best_goods
                    INNER JOIN mall_goods ON main_best_goods.goods_number = mall_goods.number
                    WHERE   main_best_goods.title_number = ".$title_number."
                    AND     main_best_goods.main_ok = 'Y'
                    AND     mall_goods.main_ok = 'Y'
                    ORDER BY main_best_goods.position_number
                    LIMIT ".$goods_etc;
        $goods->qstr = $sQuery;
        $goods->my_query();
       
        # 타이틀 이미지 정의 ----------------------------------------------------------------------
        if( $iLoop != 0 ) {
            # 타이틀 이미지가 없으면 타이틀명으로 출력
            if( $title_image == "" ) {
                # 타이틀명 출력
                echo "    <tr>\n";
                echo "        <td><b>".$title_name."</b></td>\n";
                echo "    </tr>\n";
            } else {
                # 타이틀 이미지 출력
                echo "    <tr>\n";
                echo "        <td><img src='../images/".$title_image."'></td>\n";
                echo "    </tr>\n";
                # 나이키 이벤트 종료 2008.07.10 10:04am
                //if( $title_number == 21 ){
                //    echo "    <tr>\n";
                //    echo "        <td><img src='../images/T21_080616.jpg' border='0' usemap='#nike_event'></td>\n";
                //    echo "    </tr>\n";
                //    echo "    <map name='nike_event' id='nike_event'>\n";
                //    echo "        <area shape='poly' coords='17,31,85,12,113,50,135,96,184,152,203,173,211,192,201,207,150,212,70,196,2,144,-2,72' onFocus='this.blur()' href='../shop/step1.html?Bcode=Shoes&number=72878&gstyle=' alt='바로가기' target='_blank'>\n";
                //    echo "       <area shape='poly' coords='173,62,213,55,246,74,303,115,379,148,394,185,380,204,329,217,254,218,213,201,213,181,168,132,152,105,159,65' onFocus='this.blur()' href='../shop/step1.html?Bcode=&number=68876&gstyle=' alt='바로가기' target='_blank'>\n";
                //    echo "       <area shape='poly' coords='336,133,356,54,414,39,452,40,456,77,479,101,502,134,519,163,539,184,550,199,554,217,414,204,374,142' onFocus='this.blur()' href='../shop/step1.html?Bcode=Shoes&number=65151&gstyle=' alt='바로가기' target='_blank'>\n";
                //    echo "       <area shape='poly' coords='546,72,527,92,534,109,535,117,521,127,509,130,509,140,513,152,551,184,561,208,586,209,719,129,712,85,721,44,641,72' onFocus='this.blur()' href='../shop/step1.html?Bcode=Shoes&number=82603&gstyle=' alt='바로가기' target='_blank'>\n";
                //    echo "    </map>\n";
                //}               
            }
        }

       
        # 상품 보여주기 ---------------------------------------------------------------------------
        $td_count = 0;
        echo "    <tr valign='top'>\n";
        echo "        <td align='center'>\n";
        echo "            <table border='0' width='713' align='center' cellpadding='0' cellspacing='3'>\n";
        echo "                <tr valign='top'>\n";
        if( empty($goods->rows) === false ) {
            for( $iTloop = 0; $iTloop < $goods->rows; $iTloop++ ) {
                $goods->my_fetch();
                $td_count++;
                $td_width = 100 / $td_limit;
                $rCoupon =getCouponFlag($goods->row[goods_number], $goods->row[agent_goods_flag], $goods->row[sale_cost]);
                $rEventIcon = getEventIcon($goods->row[agent_user_id]); # 이벤트 아이콘
                # 이동할 페이지 정의
                # Best of Product만 카테고리로 연결
                if( $title_number == 75 || $title_number == 141 || $title_number == 142 ) {
                    $pLinkPage = "../shop/step0.html?Bcode=".$goods->row[bc_code]."&Mcode=".$goods->row[mc_code]."&Scode=".$goods->row[sc_code]."";
                } else {
                    $pLinkPage = "../shop/step1.html?Bcode=".$Bcode."&number=".$goods->row[number];
                }
                //$pLinkPage = "../shop/step1.html?Bcode=".$Bcode."&number=".$goods->row[number];
                if( $goods->row[number] != "" ) {
                    echo "                    <td widht='".$td_width."%' style='border:1 solid;' align='center'>\n";
                    echo "                        <table border='0' width='100%' cellspacing='2' cellpadding='0' style='table-layout:fixed;'>\n";
                    echo "                            <tr valign='top'>\n";
                    if( $td_limit == 5 ) {
                        # 신발 ( 5개 보여주는 상품 )
                        if($rCoupon['flag'] == "T"){
                            echo "                                <td align='center'>\n";
                            //echo "                                    <a href='".$pLinkPage."'>\n";
                            echo "                                    <a href='#' onclick=\"location.href='".$pLinkPage."'\">\n";
                            echo "                                    <table border='0' cellpadding='0' cellspacing='0'>\n";
                            echo "                                        <tr>\n";
                            echo "                                            <td align='center' valign='ccenter' height='120' ".$rCoupon['foint']."><img src='".$goods->row[img_url].$goods->row[image_small]."' width=110 border=0>".$rCoupon['div']."</td>\n";
                            echo "                                        </tr>\n";
                            echo "                                    </table>\n";
                            echo "                                    </a>\n";
                            echo "                                </td>\n";
                        }else if( $rEventIcon['flag'] == "T" ){
                            echo "                                <td align='center'>\n";
                            echo "                                    <a href='#' onclick=\"location.href='".$pLinkPage."'\">\n";
                            echo "                                    <table border='0' cellpadding='0' cellspacing='0'>\n";
                            echo "                                        <tr>\n";
                            echo "                                            <td align='center' height='120' valign='center' ".$rEventIcon['foint']."><img src='".$goods->row[img_url].$goods->row[image_small]."' width=110 border=0>".$rEventIcon['div']."</td>\n";
                            echo "                                        </tr>\n";
                            echo "                                    </table>\n";
                            echo "                                    </a>\n";
                            echo "                                </td>\n";
                        }else{
                            echo "                                <td align='center' height='120' valign='center'><a href='".$pLinkPage."'><img src='".$goods->row[img_url].$goods->row[image_small]."' width=110 border=0></a></td>\n";
                        }
                    } else {
                        # 의류 ( 4개 보여주는 상품 )
                        if($rCoupon['flag'] == "T"){
                            echo "                                <td align='center'>\n";
                            echo "                                    <a href='#' onclick=\"location.href='".$pLinkPage."'\">\n";
                            echo "                                    <table border='0' cellpadding='0' cellspacing='0'>\n";
                            echo "                                        <tr>\n";
                            echo "                                            <td align='center' vlign='center' height='130' ".$rCoupon['foint']."><img src='".$goods->row[img_url].$goods->row[image_small]."' width=130 border=0>".$rCoupon['div']."</td>\n";
                            echo "                                        </tr>\n";
                            echo "                                    </table>\n";
                            echo "                                    </a>\n";
                            echo "                                </td>\n";
                        }else if( $rEventIcon['flag'] == "T" ){
                            echo "                                <td align='center'>\n";
                            echo "                                    <a href='#' onclick=\"location.href='".$pLinkPage."'\">\n";
                            echo "                                    <table border='0' cellpadding='0' cellspacing='0'>\n";
                            echo "                                        <tr>\n";
                            echo "                                            <td align='center' vlign='center' height='130' ".$rEventIcon['foint']."><img src='".$goods->row[img_url].$goods->row[image_small]."' width=130 border=0>".$rEventIcon['div']."</td>\n";
                            echo "                                        </tr>\n";
                            echo "                                    </table>\n";
                            echo "                                    </a>\n";
                            echo "                                </td>\n";
                        }else{
                            echo "                                <td align='center' vlign='center' height='130' ".$vFoint."><a href='".$pLinkPage."'><img src='".$goods->row[img_url].$goods->row[image_small]."' width=130 border=0></a></td>\n";
                        }
                    }
                    echo "                            </tr>\n";

                   
                    # A&M트레이딩 제품 문구보이기
                    if( ($goods->row[agent_user_id] == "indastyle" || $goods->row[agent_user_id] == "") && ( $goods->row[companyofgoods] == "BANC" || $goods->row[companyofgoods] =="PARODY9" ) ){ $pEventMungu = "<span color='red' >빅뱅협찬브랜드</span>"; }
                    else                                                                                                                                                                         { $pEventMungu = ""; }
                   
                    echo "                            <tr valign='top'>\n";
                    echo "                                <td align='center'>".$pEventMungu."<a href='".$pLinkPage."' style='color:#0E0E99;'>".$goods->row[goods_name]."</a></td>\n";
                    echo "                            </tr>\n";
                    # 세일 퍼센트 출력
                    if( $goods->row[sale_ok] == "Y" && $rCoupon['flag'] != "T" && $goods->row[agent_goods_flag] != "W" ) {
                        echo "                            <tr valign='top'>\n";
                        echo "                                <td align='center' style='color:#FF3300;'>SALE ".$goods->row[sale_percent]."% </td>\n";
                        echo "                            </tr>\n";
                    }
                    # 제조사 출력
                    if( trim($goods->row[companyofgoods]) != "" ) {
                        echo "                            <tr valign='top'>\n";
                        echo "                                <td align='center'>제조사:".$goods->row[companyofgoods]."</td>\n";
                        echo "                            </tr>\n";
                    }
                    # 할인가 출력
                    echo "                            <tr valign='top'>\n";
                    echo "                                <td align='center' style='color:#CC6600;'><b>".number_format($goods->row[sale_cost])."</b>원</td>\n";
                    echo "                            </tr>\n";
                    if( $rCoupon['flag'] == "T" ){
                    # 쿠폰가격 출력
                    echo "                            <tr valign='top'>\n";
                    echo "                                <td align='center' ><strong>쿠폰적용가:<span style='color: #FF0000'>".number_format($rCoupon['coupon_cost'])."원</span></strong></td>\n";
                    echo "                            </tr>\n";
                    }

                    # 품절 출력
                    if( trim($goods->row[empty_goods]) == "Y" ) {
                        echo "                            <tr valign='top'>\n";
                        echo "                                <td align='center'><img src='../img/empty.gif' align='absmiddle'></td>\n";
                        echo "                            </tr>\n";
                    } else if( trim($goods->row[empty_goods]) == "C" ) {
                        echo "                            <tr valign='top'>\n";
                        echo "                                <td align='center'><img src='../img/empty1.gif' align='absmiddle'></td>\n";
                        echo "                            </tr>\n";
                    }
                    echo "                        </table>\n";
                    echo "                    </td>\n";
                }
                if( $td_count == $td_limit ) {
                    $td_count = 0;
                    if( ( $iTloop + 1 ) != $goods->rows ) {
                        echo "                </tr>\n";
                        echo "                <tr valign='top'>\n";
                    }
                }
            }
        } else {
            # 등록된 상품이 없을경우
            echo "                    <td align='center' class='black1' style='border:1 solid;'>등록된 상품이 없습니다.</td>\n";
        }
        echo "                </tr>\n";
        echo "            </table>\n";
        echo "        </td>\n";
        echo "    </tr>\n";
    }     
    $sMALL_GOODS -> my_db_close();
    $sMALL_EXBUY -> my_db_close();   
?>
</table>

추천
1

댓글 2개

위 소스는 적용 안되서 나오는거 같은데...
글자자르는 function 하나 만들어서 적용해서 뿌려주면 될거 같아요~
항상 말은쉬워요;;; 도움 못드려서 죄송합니다~
전체 22 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT