외부 URL 로 접속하기 > 그누커머스 팁자료실

그누커머스 팁자료실

그누커머스와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

외부 URL 로 접속하기 정보

외부 URL 로 접속하기

본문

그누커머스 작업 중인데요.. 

깨알 팁

 

외부 URL 로 접속하기

 

워드프레스는 외부에서 URL 주소로 접근을 할 수 없습니다.

 

논리적인 주소로 접근해야 하는데요

 

1. DB 테이블 wp_posts에 값 추가하기

워드 프레스는 위 테이블을 이용해서 외부에서 접속 가능한 프로그램을 결정하게 됩니다.

[중요 컬럼]

guid : 브라우저 상 URL 주소  (http://URL/order)

post_content :  shortcode 클래스 실행 값

이 곳에 입력된 값을 이용해서 shortcode 클래스를 실행하게 됩니다. 

주의 할 것은 [gnucommerce_order] 

대괄호를 넣어줘야 합니다.

 

2. /home/hosting_users/smartev/www/wp-content/plugins/gnucommerce/lib/shortcode

위 폴더에 외부에서 접근할 파일을 만들어준다.

order.php ( http://URL/order )

 

[파일 내용] 

 <?php

if( ! defined( 'GC_NAME' ) ) exit;

 

if ( !class_exists( 'GC_shortcode_order' ) ) :

 

Class GC_shortcode_order{

 

    public static function output( $atts ) {

 

        global $wpdb;

 

        $config = GC_VAR()->config;

        $gc = GC_VAR()->gc;

        include( GC_SHOP_DIR_PATH.'/orderform.php' ); // <== 이 파일을 실행함

 

    }

}

 

endif;  //Class exists end if

?>

 

3. /www/wp-content/plugins/gnucommerce/lib/gc_shortcode.class.php

    public static function init() {

        $shortcodes = array(

            GC_NAME.'_cart'    => __CLASS__ . '::cart',    //장바구니 페이지

            GC_NAME.'_order'    => __CLASS__ . '::order',    //결제 페이지

            GC_NAME.'_mypage'    => __CLASS__ . '::mypage',    //내 계정 페이지

            GC_NAME.'_shop'    => __CLASS__ . '::shop',    //상품 페이지

            GC_NAME.'_register' => __CLASS__ . '::register',    //회원가입 페이지

            GC_NAME.'_shop_latest'    => __CLASS__ . '::shop_latest',    //상품 페이지

            GC_NAME.'_item' =>  __CLASS__ . '::item',    //상품 보여주기

            GC_NAME.'_personalpay' =>  __CLASS__ . '::personalpay',    //개인 결제

            GC_NAME.'_itemuse' =>  __CLASS__ . '::itemuse',    //상품후기숏코드

        );

//$shortcodes 배열에 값 추가 

예)  GC_NAME.'_order' =>  __CLASS__ . '::order',    //이런식으로 

......................

    }

 

 

    //order-- 새로 추가

        public static function order($atts) {

        include_once( GC_SHORTCODE_DIR_PATH.'/'. __FUNCTION__ .'.php' );

        return self::shortcode_wrapper( array( 'GC_shortcode_order', 'output' ), $atts);

        }

 

 

여기까지 하면 외부 URL을 이용해서 서버에 있는 파일을 실행할 수 있습니다.

추천
0
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로