• I am using the plugin php-to-page by Bloafer to include php in many of the pages on my wordpress site. I would like to include some php code that has an include in it and I can’t seem to get it to work.

    The include is a database connection class to allow me to dynamically populate what is on a particular page. I can get it to work if I put it right in the php file I’m include using the plugin but I’d like to only have the connection info in one place and not in the WordPress folder structure.

    This is what works in the php file…

    $db = MySqlDatabase::getInstance();
    
    // connect
    try {
        $db->connect('xxxxxx', 'xxxxxx', 'xxxxxx', 'xxxxx');
    }
    catch (Exception $e) {
        die($e->getMessage());
    }

    This is how I’d like to include it instead …

    include(ABSPATH . ‘/ds_2cnx_class.php’);

    Any ideas how I can get this to work?

Viewing 1 replies (of 1 total)
  • Bloafer

    (@bloafer)

    I would use the internal WP database functions for this, but you can use the plugin to include multiple files, this would probably overcome your issues

Viewing 1 replies (of 1 total)
  • The topic ‘Using a PHP include within PHP-to-Page plugin’ is closed to new replies.