ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

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

putcharaporn_tan
PHP Super Member
PHP Super Member
โพสต์: 394
ลงทะเบียนเมื่อ: 04/08/2015 10:01 am
ติดต่อ:

ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

ดึงภาพจาก ฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่ขึ้นค่ะ
อันนี้เป็นโค้ด ไฟล์ main.php ใน controler ค่ะ

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

         
           global $config,$db;
           $joomla_host=$config['joomla_host'];
           $joomla_path=$config['joomla_path'];
           $joomla_pf=$config['joomla_prefix'];
           $sql = 'SELECT id,name,params,publish_down 
           FROM ' .$joomla_pf._.banners ;
           $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $params = $row['params'];  
                $params_url = json_decode($params);
                $img_url=$params_url->imageurl;
                $img_alt=$params_url->alt;
                $img_width=$params_url->width;
                $img_height=$params_url->height;
        }
      
        $this->template->assign_var('IMG_URL',$img_url);
        $this->template->assign_var('IMG_ALT',$img_alt);
        $this->template->assign_var('IMG_WIDTH',$img_width);
        $this->template->assign_var('IMG_HEIGHT',$img_height);
        $this->template->assign_var('JOOMLA_HOST',$joomla_host);
        $this->template->assign_var('JOOMLA_PATH',$joomla_path);
        return $this->helper->render('main.html');
 
โค้ดจา กฝั่ง html ค่ะ

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

<img  src="http://{JOOMLA_HOST}/{JOOMLA_PATH}/{IMG}" alt="{IMG_ALT}" width="{IMG_WIDTH}" height="{IMG_HEIGHT}"></img>

อันนี้เป็น url ที่ได้ตอนดู source ค่ะ

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

<img src="http://localhost/test_joomla/" alt="pic1" width="300" height="450">
putcharaporn <3
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

<img src="http://localhost/test_joomla/" alt="pic1" width="300" height="450"> ยังไม่เข้าถึงรูปค่ะ


ชื่อรูปหายไป
<img src="http://localhost/test_joomla/xxxx.png" alt="pic1" width="300" height="450">
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

การส่งค่าไปยังเทมเพลต

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

  $this->template->assign_var('IMG_URL',$img_url);
        $this->template->assign_var('IMG_ALT',$img_alt);
        $this->template->assign_var('IMG_WIDTH',$img_width);
        $this->template->assign_var('IMG_HEIGHT',$img_height);
        $this->template->assign_var('JOOMLA_HOST',$joomla_host);
        $this->template->assign_var('JOOMLA_PATH',$joomla_path);
ปรับให้เป็น array เพื่อส่งได้หลายๆ ค่า ก็ได้ค่ะ
ตัวอย่าง

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

$this->template->assign_vars(array(
            'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false,
            'U_LOGIN_LOGOUT' => $u_login_logout,
            'L_LOGIN_LOGOUT' => $l_login_logout,
            'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
            'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false,
            'U_REGISTER' => 'zzz'
            'S_LOGIN_ACTION' => $server_url . '/' . append_sid("ucp.$this->php_ext", "mode=login"),
        ));
putcharaporn_tan
PHP Super Member
PHP Super Member
โพสต์: 394
ลงทะเบียนเมื่อ: 04/08/2015 10:01 am
ติดต่อ:

Re: ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

ข้อมุลขึ้นหลดแล้วค่ะแต่ภาพก็ยังไม่ขึ้นเหมือนเดิม

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

<img src="http://localhost/test_joomla/images/banners/1.jpg" alt="pic1" width="300" height="450">
putcharaporn <3
putcharaporn_tan
PHP Super Member
PHP Super Member
โพสต์: 394
ลงทะเบียนเมื่อ: 04/08/2015 10:01 am
ติดต่อ:

Re: ดึงภาพจากฐานข้อมูล joomla มาแสดงใน phpBB แล้วมันไม่แสดงภาพค่ะ

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

แก้ไขได้แล้วค่ะ พอดีว่าใส่ url ผิดค่ะขอบคุณค่ะ
putcharaporn <3
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

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