ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ

ตอนนี้ลองทำเเล้ว เป็นหน้าที่ส่งตัวแปล มาทาง url เสร็จเเล้ว จะใช้วิธีเรียกเหมือน Template เเต่ติดปัญหา คือบุคคลภายนอกจะเข้ามาใน url นี้ไม่ได้
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

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

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
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ถ้าจาก ตัวอย่าง

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

$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


แต่ยังส่งค่าไปไม่ได้
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: witsarutt000 และบุคลทั่วไป 49