Accessing Database from an External File
Permalink
Hi,
It seems that the proper way to work with the database is to use:
Loader::db()
However, I have a file that is in my block's folder that needs to access the db, but I don't know how to get the Loader class (and all the stuff that comes with it?). How can a file that is outside of the template (essentially, outside of c5. yet in the same folder with my block) access db info without explicitly asking the user for credentials. I could save the login credentials in a php file when the block is installed, but that would be unwelcome I assume, and perhaps a security risk.
Thanks, let me know if I need to clarify anything.
It seems that the proper way to work with the database is to use:
Loader::db()
However, I have a file that is in my block's folder that needs to access the db, but I don't know how to get the Loader class (and all the stuff that comes with it?). How can a file that is outside of the template (essentially, outside of c5. yet in the same folder with my block) access db info without explicitly asking the user for credentials. I could save the login credentials in a php file when the block is installed, but that would be unwelcome I assume, and perhaps a security risk.
Thanks, let me know if I need to clarify anything.