สอบถามการใช้ meta_refresh ใน phpbb3 เปลี่ยนหน้าจอ

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: สอบถามการใช้ meta_refresh ใน phpbb3 เปลี่ยนหน้าจอ

Re: สอบถามการใช้ meta_refresh ใน phpbb3 เปลี่ยนหน้าจอ

โดย บุคคลทั่วไป » 19/10/2022 7:02 am

มีวิธีง่ายกว่านี้ไหม เขียนเป็นแค่ html

Re: สอบถามการใช้ meta_refresh ใน phpbb3

โดย mindphp » 30/11/2012 5:31 pm

โค้ด: เลือกทั้งหมด

if($sql_query) {
    $meta_info = append_sid($phpbb_root_path.'view.'.$phpEx);
 } else {
    $meta_info = append_sid($phpbb_root_path.'form.'.$phpEx);
}
meta_refresh(3, $meta_info);
 
ในส่วนของ Template include overall_header.html
หรือยัง

Re: สอบถามการใช้ meta_refresh ใน phpbb3

โดย modtanoy_pen » 30/11/2012 5:18 pm

ขอโทษนะคะรบกวนช่วยดู code ให้หน่อยคะ พอดีลองทำดูแล้วคือต้องการ insert ข้อมูลแล้วให้ลิงค์ไปที่หน้า view ข้อมูล แต่มันไม่ไปคะ

โค้ด: เลือกทั้งหมด

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// ตั้งค่าตัวแปลเพื่อรับค่าจากฟอร์ม
$nameth         = request_var('nameth', '', true);
$nameeg         = request_var('nameeg', '', true);
$detail         = request_var('detail', '', true);
$address        = request_var('address', '', true);
$province       = request_var('province', '', true);
$tel1           = request_var('tel1', '', true);
$fax            = request_var('fax', '', true);
$webs           = request_var('webs', '', true);
$name           = request_var('name', '', true);
$gender         = request_var('gender', '', true);
$email          = request_var('email', '', true);
$tel2           = request_var('tel2', '', true);
$mobile        = request_var('mobile', '', true);
$sql = 'INSERT INTO ' . TEST_TABLE . ' ' . $db->sql_build_array('INSERT', array(
    'nameth'    =>  (string)$nameth,
    'nameeg'    =>  (string)$nameeg,
    'detail'    =>  (string)$detail,
    'address'   =>  (string)$address,
    'province'  =>  (string)$province,
    'tel1'      =>  (string)$tel1,
    'fax'       =>  (string)$fax,
    'webs'      =>  (string)$webs,
    'name'      =>  (string)$name,
    'gender'    =>  (string)$gender,
    'email'     =>  (string)$email,
    'tel2'      =>  (string)$tel2,
    'mobile'    =>  (string)$mobile)    
);
$sql_query = $db->sql_query($sql);
if($sql_query) {
    $meta_info = append_sid("{$phpbb_root_path}view.$phpEx");
 } else {
    $meta_info = append_sid("{$phpbb_root_path} form.$phpEx");
}
meta_refresh(3, $meta_info);
?>

Re: สอบถามการใช้ meta_refresh ใน phpbb3

โดย mindphp » 27/11/2012 4:08 pm

โค้ด: เลือกทั้งหมด

$meta_info = ($mode == 'post') ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); 

meta_refresh(3, $meta_info); 
ถ้าจะเขียนแบบย่อ ถ้าจะให้เข้าใจง่ายๆ จะเอามาเขียน if...else แบบ เต็มก่อนนะครับ

โค้ด: เลือกทั้งหมด

// เงื่อนไขเพื่อหาว่า url ที่จะให้เปลี่ยนหน้าไปที่หน้าไหน 
if( ($mode == 'post') ) {
 $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
} else {
 $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); 
}
meta_refresh(3, $meta_info);
 

สอบถามการใช้ meta_refresh ใน phpbb3 เปลี่ยนหน้าจอ

โดย modtanoy_pen » 27/11/2012 3:18 pm

สอบถามการใช้ meta_refresh ในphpbb3
ตัวอย่างนะคะ รบกวนช่วยอธิบายการทำงานให้หน่อยดูแล้วไม่เข้าใจคะ

โค้ด: เลือกทั้งหมด

<?php $meta_info = ($mode == 'post') ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); 

meta_refresh(3, $meta_info);
?>

ข้างบน