My Package Libraries Loader DB

Permalink
hi there

I am looking for loader db in my package libraries that I want to current of bID from block in libraries function.

package
|
|-test
|
|- libraries - test.php

function tester(){
$db = Loader::db();

current block bID ?

}

|-test
|
|- block - view.php

Loader::library('test');

I have tried to use code $this->bID but it message error say Fatal error: Using $this when not in object context in.

Any idea

 
JSA1972 replied on at Permalink Reply
Package Libraries - test.php

$bID = (block's bID. I have tried to '$this->bID')
$data = $db->getRow("SELECT bID FROM TestTable WHERE bID = ?",array($bID));
foreach ($data  as $column => $value) {
   echo $value;
 }


Anyone can help please thanks
mkly replied on at Permalink Reply
mkly
Hello,
This is how you load a library from a package
Loader::library('test', 'my_package_handle');

Load the database connection(ADODB)
$db = Loader::db();


I'm not sure where you are looking for the bID. Are you using this library in a block?

Best Wishes,
Mike
JSA1972 replied on at Permalink Reply
Hello mkly

Thanks for your replied.

No I'm using libraries in Package

my_package_hand-->libraries
JSA1972 replied on at Permalink Reply
I think, I was wrong. But should be use my_ package_hand-->block-->libraries if that will be work.

my_ package_hand-->block-->libraries
JSA1972 replied on at Permalink Reply
Why is not working $this->btTable in my package hand libraries - test.php?

It's message error 'Fatal error: Using $this where not in object context in'

$bID = $block->bID;
$data = $db->getRow("SELECT bID FROM TestTable WHERE bID = ?",array($bID));
foreach ($data  as $column => $value) {
   echo $value;
 }
jordanlev replied on at Permalink Reply
jordanlev
If you are making a library, then it is not a block. So none of the block functions work because you are not in a block -- instead you are in a library.