2014-06-07 26 views
1

我有一個ZF web應用程序啓動並運行。現在我們正計劃將博客添加到我們的網絡應用程序。我正在考慮使用WP博客,因爲超級緊湊的時間表來完成博客系統。注意:我不想將我的ZF應用程序轉換爲WP應用程序。將wordpress添加到現有的ZF web應用程序 - 在哪裏安裝?

關於如何在Google上集成ZF和wordpress,所以在安裝WP之前,我想確保我處於正確的道路上。所以在這裏,這是我通過查看我在互聯網上發現的一些文章而學到的。

我ZF的目錄結構如下所示:(這只是粗結構)

trunk/
    module/
     app/
      (contains controller, view, model) 
    public/
     css 
     js 
    vendor/
     ZF 

1)創建ZP內部應用程序的新目錄(假設www.domain.com/blog)
2 )在博客目錄下上傳並安裝WP。
3)將以下標題添加到所有PHP頁面。

<?php 
/* This make the magic: */ 
define('WP_USE_THEMES', false); 
require('path-to-the-file/wp-blog-header.php'); 

我的問題是我應該在哪裏創建博客文件夾並上傳/安裝WP?它會在查看文件夾下嗎?或在公共文件夾?另外,有什麼我需要包含在路徑的根索引文件?

這是我的index.php文件看起來它位於公用文件夾

<?php 
/** 
* This makes our life easier when dealing with paths. Everything is relative 
* to the application root now. 
*/ 
chdir(dirname(__DIR__)); 

function debug($data) { 
    try { 
     throw new Exception(); 
    } catch(Exception $e) { 
     $trace = $e->getTrace(); 
     $desc = array_shift($trace); 
     $info = $desc['file'].' on line '.$desc['line'].''; 
     $infoS = basename($desc['file']).'('.$desc['line'].')'; 
    } 
    $errTempId = 'e'.mt_rand(0,9999999999999); 
    $onClick = "e=document.getElementById('".$errTempId."');if(e.style.display=='none'){e.style.display='';}else{e.style.display='none';}"; 
    echo '<strong style="color:#006699"><acronym style="cursor:pointer;" title="'.$info.'" onClick="'.$onClick.'"><span style="font-size:11px; font-weight:normal;">'.$infoS.' debug:</span></acronym></strong><span id="'.$errTempId.'">'; 
    if(is_object($data) === true or is_array($data) === true) { 
     echo '<pre>'; 
     print_r($data); 
     echo '</pre><br />'; 
    } else if(is_null($data)) { 
     echo '<i>NULL</i><br />'; 
    } else { 
     echo $data.'<br />'; 
    } 
    echo '</span>'; 
} 

function arrayMerge($a, $b) { 
    foreach($b as $k => $v) { 
     $a[$k] = $v; 
    } 
    return $a; 
} 

error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE); 
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING); 

// Setup autoloading 
require 'init_autoloader.php'; 

// Run the application! 
Zend\Mvc\Application::init(require 'config/application.config.php')->run(); 

htaccess文件一樣(以防萬一我需要修改任何東西在這裏)

RewriteEngine On 
# The following rule tells Apache that if the requested filename 
# exists, simply serve it. 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
# The following rewrites all other queries to index.php. The 
# condition ensures that if you are using Apache aliases to do 
# mass virtual hosting, the base path will be prepended to 
# allow proper resolution of the index.php file; it will work 
# in non-aliased environments as well, providing a safe, one-size 
# fits all solution. 
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ 
RewriteRule ^(.*) - [E=BASE:%1] 
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] 
# The following rule blocks botnets scripts 
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L] 
# The following rule maps IP address with domain name 
RewriteCond %{HTTP_HOST} ^***\.**\.***\.** 
RewriteRule (.*) http://www.domain.com/$1 [R=301,L] 

回答

0

通常情況下, public/dir是zend應用程序中唯一的公共可訪問目錄,並被用作域的文檔根目錄。 所以,如果你想你的博客在domain.com/blog/下,你必須把它公諸於衆/博客/

你不必修改zend應用程序的任何文件。

相關問題