We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

expression engine code question

Development and Programming

EpicSoft's avatar
EpicSoft
64 posts
16 years ago
EpicSoft's avatar EpicSoft

I was wondering if this is allowed with expression engine.

<?
// PHP back end file
define('EXT','foo');
require("../path.php");
require(".".$system_path."config.php");
require(".".$system_path."db/db.mysql.php");
$db_config = array(
                        'hostname'      => $conf['db_hostname'],
                        'username'      => $conf['db_username'],
                        'password'      => $conf['db_password'],
                        'database'      => $conf['db_name'],
                        'prefix'        => $conf['db_prefix'],
                        'conntype'      => $conf['db_conntype'],
                        'debug'            => 0,
                        'show_queries'    => FALSE,
                        'enable_cache'    => FALSE
                      );
    $DB = new DB($db_config);
    $feilds_q = $DB->query("SELECT * FROM ...");
...
...
?>

Not wanting to use raw mysql_query() and all it’s friends i got the $DB class to work outside of expression engine system for a back end script that runs on my expression engine site. I’ve made no edits to anything in /system/ i just reference it with the above code. The other part of the module is with in expression engine and just uses $DB->whatever(). So is this allowed to be done this way?

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
16 years ago
Erin Dalzell's avatar Erin Dalzell

If you want some of the power of EE’s DB querying, why not take a look at CodeIgniter? That might keep things nicely abstracted for you.

       
EpicSoft's avatar
EpicSoft
64 posts
16 years ago
EpicSoft's avatar EpicSoft
If you want some of the power of EE’s DB querying, why not take a look at CodeIgniter? That might keep things nicely abstracted for you.

because I’m writing a module for expression engine not a stand alone app. It just that this one file is executed by it self.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.