ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ
ตอนนี้ลองทำเเล้ว เป็นหน้าที่ส่งตัวแปล มาทาง url เสร็จเเล้ว จะใช้วิธีเรียกเหมือน Template เเต่ติดปัญหา คือบุคคลภายนอกจะเข้ามาใน url นี้ไม่ได้
ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ
Moderator: mindphp, ผู้ดูแลกระดาน
- thatsawan
- PHP VIP Members
- โพสต์: 28508
- ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
- ติดต่อ:
- thatsawan
- PHP VIP Members
- โพสต์: 28508
- ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
- ติดต่อ:
Re: ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ
โค้ด: เลือกทั้งหมด
protected function setup_template()
{
global $phpbb_container, $phpbb_dispatcher;
if ($this->template instanceof \phpbb\template\template)
{
return;
}
$template_environment = new \phpbb\template\twig\environment(
$phpbb_container->get('config'),
$phpbb_container->get('filesystem'),
$phpbb_container->get('path_helper'),
$phpbb_container->getParameter('core.template.cache_path'),
$phpbb_container->get('ext.manager'),
new \phpbb\template\twig\loader(
$phpbb_container->get('filesystem')
),
$phpbb_dispatcher,
array()
);
$template_environment->setLexer($phpbb_container->get('template.twig.lexer'));
$this->template = new \phpbb\template\twig\twig(
$phpbb_container->get('path_helper'),
$phpbb_container->get('config'),
new \phpbb\template\context(),
$template_environment,
$phpbb_container->getParameter('core.template.cache_path'),
$phpbb_container->get('user'),
$phpbb_container->get('template.twig.extensions.collection'),
$phpbb_container->get('ext.manager')
);
}
/**
* Set template paths to load
*/
protected function set_template_paths($path_name, $paths)
{
$this->setup_template();
$this->template->set_custom_style($path_name, $paths);
}
โค้ด: เลือกทั้งหมด
$this->set_template_paths($ext_template_paths, $template_paths);
$this->template->set_filenames(array(
'body' => $template_file . '.txt',
));
- thatsawan
- PHP VIP Members
- โพสต์: 28508
- ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
- ติดต่อ:
Re: ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ
ถ้าจาก ตัวอย่าง
เปลี่ยน เป็นไฟล์ HTML ของเรา ต้่องสร้างไว้ใน Template ก่อน
จากนั้นจะได้
$this->template_filename
URL สำหรับ HTML ที่ต้องการ
file:///D:/xampp/htdocs/phpbb/styles/thaivi/template/receipt.html
แต่ยังส่งค่าไปไม่ได้
โค้ด: เลือกทั้งหมด
$template = new \phpbb\template\twig\twig(
$phpbb_container->get('path_helper'),
$phpbb_container->get('config'),
new \phpbb\template\context(),
new \phpbb\template\twig\environment(
$phpbb_container->get('config'),
$phpbb_container->get('filesystem'),
$phpbb_container->get('path_helper'),
$phpbb_container->getParameter('core.cache_dir'),
$phpbb_container->get('ext.manager'),
new \phpbb\template\twig\loader(
$phpbb_filesystem
)
),
$phpbb_container->getParameter('core.cache_dir'),
$phpbb_container->get('user'),
$phpbb_container->get('template.twig.extensions.collection'),
$phpbb_extension_manager
);
$template->set_style();
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
$this->template_filename = $template->get_source_file_for_handle('bbcode.html');
เปลี่ยน เป็นไฟล์ HTML ของเรา ต้่องสร้างไว้ใน Template ก่อน
โค้ด: เลือกทั้งหมด
$template->set_filenames(array('receipt.html' => 'receipt.html'));
$this->template_filename = $template->get_source_file_for_handle('receipt.html');
$this->template_filename
URL สำหรับ HTML ที่ต้องการ
file:///D:/xampp/htdocs/phpbb/styles/thaivi/template/receipt.html
แต่ยังส่งค่าไปไม่ได้
- Sirayu
- PHP Sr. Member
- โพสต์: 94
- ลงทะเบียนเมื่อ: 12/06/2019 11:30 am
- ติดต่อ:
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
- 4 ตอบกลับ
- 1942 แสดง
-
โพสต์ล่าสุด โดย eange08
15/01/2021 10:22 am
-
- 0 ตอบกลับ
- 1972 แสดง
-
โพสต์ล่าสุด โดย mindphp
19/12/2022 6:22 am
-
-
โพสต์ใหม่ อยากทราบวิธีการดึงรูปภาพที่เป็นไฟล์แนบจาก phpbb มาใน html
โดย Ittichai_chupol » 11/06/2019 5:20 pm » ใน Programming - PHP - 4 ตอบกลับ
- 2585 แสดง
-
โพสต์ล่าสุด โดย Bill Willis
04/08/2023 4:16 pm
-
-
-
โพสต์ใหม่ อยากทราบวิธีการ สร้างไฟล์ html ขึ้นมาเมื่อมีการกดปุ่ม ใน phpbb
โดย Ittichai_chupol » 08/06/2019 7:05 pm » ใน Programming - PHP - 1 ตอบกลับ
- 1019 แสดง
-
โพสต์ล่าสุด โดย thatsawan
08/06/2019 7:28 pm
-
-
-
โพสต์ใหม่ การสร้างไฟล์ event ในรูปแบบ html สำหรับ phpbb
โดย Ittichai_chupol » 29/01/2019 5:33 pm » ใน PHP Knowledge - 0 ตอบกลับ
- 2142 แสดง
-
โพสต์ล่าสุด โดย Ittichai_chupol
29/01/2019 5:33 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: Bing [Bot], Google Adsense [Bot] และบุคลทั่วไป 107