2015-12-08 73 views
0

客戶想要將他們使用Adobe Catalyst製作的網站移動到不同的託管服務提供商。我能夠通過FTP複製整個網站並將其移至新主機。一切看起來很好,除了許多鏈接留下代碼,看起來像這樣:當遷移催化劑網站離開模塊代碼

{module_contentholder, name="_U309"} {module_contentholder, name="_U299"} 

有人知道這是什麼或如何解決它?

回答

2

這些是對Content Holders.的引用它們的工作與PHP的include語句類似,但它們引用的文件固定爲單一路徑:/_System/ContentHolders/

您可能會遇到更多此類標籤,例如{module_menu}{tag_pagecontent}。您需要手動調整它們以適應新主機的使用。該文件將幫助:http://docs.businesscatalyst.com/reference/


在你的例子所示的內容持有人的姓名鈍表示網站很可能已被Adobe Muse, WYSIWYG編輯器生成的。我強烈建議您找到原始.muse項目文件,並使用它們來更新該網站。 Muse can compile the site for platforms other than Business Catalyst.

0

通過研究,我發現沒有辦法讓這些代碼正確顯示而無需單獨編輯每個頁面。幸運的是,我編寫了一個PHP腳本,通過每個頁面的代碼並自動替換它。

步驟1:在一個名爲replacement.php

步驟2索引目錄中的文件:將這個代碼

$file = $_GET['file']; 
$path = '/path/to/public_html/' . $file; 
$file_contents = file_get_contents($path); 
preg_match_all("/{module(.*?)}/", $file_contents, $matches); 
foreach($matches[0] as $match) { 
    if(preg_match('/\"([^\"]*?)\"/', $match, $query)) { 
     $queryNew = str_replace("\"", "", $query[0]); 
     $queryPath = '/path/to/public_html/_System/ContentHolders/' . strtolower($queryNew) . '.html'; 
     $queryContents = file_get_contents($queryPath); 
     $file_contents = str_replace($match, $queryContents, $file_contents); 
    } 
} 

file_put_contents($path, $file_contents); 

步驟3:更換它說:/路徑/到/的public_html /到您的域名文件位置。

第4步:轉到http://www.yourdomain.com/replacement.php?file=index.html以更改索引文件。您可以將url中的「index.html」更改爲您要轉換的任何其他頁面。

希望這可以幫助別人在未來。