wr_10 여분변수의 값에 따라서 특정 글로 이동하게 하려고 합니다.
본문
wr_10의 여분변수에 저장한 값에 따라서 특정 글로 이동하게 하려고 합니다.
그런데 테마를 쓰고 있는데 테마마다 wr_10를 확인해서 이동하게 하지않고,
그누보드 자체에 있는 곳에서 이를 행하려고 했는데 잘 안되네요.
일단 생각했던 것은 훅을 이용해서
add_event('common_header', function ($write) {
echo $write['wr_10'];
});
를 해봤는데 아무것도 출력이 되지 않습니다. ( 값은 있습니다. )
목적을 달성하기 위해서 어떻게 해야 할까요? (꼭 훅이 아니어도, 테마 별로 다 손대지 않고 한번에
해결할 수 있는 방법 있으면 조언 좀 주십시요)
감사합니다.
답변 2
* /tail.php 3라인에 추가
if ($view['wr_10']) 
  goto_url('https://sir.kr/' . '?abc=' . $view['wr_10']);
extend/your_filename.extend.php
function hook_common_header_view() {
    global $g5;
 
    $bo_table = isset($_GET['bo_table']) == true ? $_GET['bo_table'] : null;
    $wr_id    = isset($_GET['wr_id']) == true    ? $_GET['wr_id']    : null;
    $w        = isset($_GET['w']) == true        ? $_GET['w']        : null;
 
    $wr_id_ext_field = 'wr_10';
 
    $view = null;
    if ($w == null && $bo_table != null && is_numeric($wr_id) == true) {
        $write_table = $g5['write_prefix'] . $bo_table;
        $view = get_write($write_table, $wr_id);
    }
 
    if (isset($view['wr_id']) == true && $view['wr_id'] == $wr_id && is_numeric($view[$wr_id_ext_field]) == true) {
        $uri = get_pretty_url($bo_table, $view[$wr_id_ext_field]);
        $uri = htmlspecialchars_decode($uri);
        header('Location: ' . $uri);
        exit();
    }
}
add_event('common_header', 'hook_common_header_view', G5_HOOK_DEFAULT_PRIORITY, 0);
                답변을 작성하시기 전에 로그인 해주세요.
            
    
 
 