Q - วิธีการแก้ไข้ปัญหาการเรียกใช้งาน function render() ในการทำ extention บน phpbb

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

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

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

Re: Q - วิธีการแก้ไข้ปัญหาการเรียกใช้งาน function render() ในการทำ extention บน phpbb

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

แสดงว่า ไฟล์ service น่าจะยังผิดยุ
cap รูป การวางไฟล์ใน folder เเต่ละอันมาดูหน่อย
ภาพประจำตัวสมาชิก
Ittichai_chupol
PHP VIP Members
PHP VIP Members
โพสต์: 5410
ลงทะเบียนเมื่อ: 19/09/2018 10:33 am

Re: Q - วิธีการแก้ไข้ปัญหาการเรียกใช้งาน function render() ในการทำ extention บน phpbb

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

วิธีแก้คือ
ปรับเปลี่ยน ในไฟล์ main.php กับ ไฟล์ services.yml ดังนี้




ไฟล์ main.php

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

<?php

namespace mindphp\sample1\controller;

use Symfony\Component\DependencyInjection\Container;

class main {

    public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, 
            \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper,  Container $phpbb_container, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, $table_prefix, $phpbb_root_path, $php_ext) {
    
        $this->config = $config;
        $this->db = $db;
        $this->template = $template;
        $this->user = $user;
        $this->helper = $helper;
        $this->phpbb_container = $phpbb_container;
        $this->request = $request;
        $this->auth = $auth;
        $this->pagination = $pagination;
        $this->table_prefix = $table_prefix;
        $this->phpbb_root_path = $root_path;
        $this->php_ext = $php_ext;
    }

    function base($page = 1) {

       $page_title =  $this->user->lang('MINDPHP');
       print_r($this->user->ip);
       print_r($this->user->data['user_id']);
       
       
       return $this->helper->render('sample1_body.html', $page);
    }

}


ไฟล์ services.yml

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

services:
    mindphp.sample1.controller:
        class: mindphp\sample1\controller\main
        arguments:
            - @config
            - @dbal.conn
            - @template
            - @user
            - @controller.helper
            - @service_container
            - @request
            - @auth
            - @pagination
            - %core.table_prefix%
            - %core.root_path%
            - %core.php_ext%
ขอให้วันนี้เป็นวันที่ดี
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

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