Zend Framework and Wordpress Integration

前端 未结 6 961
心在旅途
心在旅途 2020-12-13 22:16

We have an existing Zend Framework site hosted at ourdomain.com and a wordpress blog at blog.ourdomain.com

We want to migrate the blog into the site at ourdomain.com

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 22:57

    I often use this configuration actually , here's what I do:

     /application
     /library
         /Zend 
         /wordpress ( symlink to my wordpress folder )
     /public
         index.php ( i add wordpress & the zend folder to my include path )
    

    Admittedly a bit of a brutal solution , considering all the unnecessary stuff that's included in the process...

    Edit:

    // Define path to application directory
    defined('APPLICATION_PATH')
        || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
    
    // Define application environment
    defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    
    // Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(
        realpath(APPLICATION_PATH . '/../library'),
        realpath(APPLICATION_PATH . '/../library/wordpress'),
        get_include_path(),
    )));
    
    //Get the wordpress environment
    define('WP_USE_THEMES', false);
    require_once 'wp-blog-header.php';
    
    /** Zend_Application */
    require_once 'Zend/Application.php';  
    
    
    
    // Create application, bootstrap, and run
    $application = new Zend_Application(
        APPLICATION_ENV, 
        APPLICATION_PATH . '/configs/application.ini'
    );
    $application->bootstrap()
                ->run();
    

提交回复
热议问题