CodeCharge Studio(CCS) 與 Joomla 整合

CodeCharge Studio 2.x, 3.x, 4.x, 5.x
回覆文章
yehlu
Site Admin
文章: 3244
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

CodeCharge Studio(CCS) 與 Joomla 整合

文章 yehlu »

http://blog.leoshiang.com/?p=103

自從我開始使用 CodeCharge Studio 以來,遇到最大問題就是做出來的網站不夠美觀。Joomla 有很多美觀的 Temaplte 可以使用,但是缺乏開發 Web 應用程式的工具。最近在官網的論壇上找到一篇文章,詳細的說明了整合的步驟,整個實作過程如下。

準備工作
我的開發環境是在本機用 XAMPP 做測試,joomla 系統安裝在網站根目錄下的 twnav。CCS 專案的輸出目錄設定在 twnav 下的子目錄 mg,此目錄可以是任意選擇。Joomla 系統安裝完成之後,要確定 CCS 專案可以連結到 joomla 的資料庫。

CCS: 確認可以連結到 Joomla 的資料庫
CCS: 設定安全性選項
在 Security 頁面,設定

User Table = jos_users
User ID Field = id
Login Field = username
Password Field = password
Level/Group Field = gid
CCS: 設定群組資料
在此頁面新增 joomla 的群組資料
25 = Super Administrator
24 = Administrator
23 = Manager
21 = Publisher
20 = Editor
19 = Author
18 = Registered

CCS: 設定 Session 變數
在 Security 頁面,點選 Advanced,出現 Advanced Secuerity Settings 視窗。
User ID Variable = josUserID
User Login Variable = josUserLogin
Group ID Variable = josGroupID

CCS: 修改 Common.php
在 Common.php 最後面加入下列程式碼

global $Login;
$conn = new clsDBblog.leoshiang.com(); // CCS-db-connection which is the joomla-db
$sessioncookie = CCGetFromGet("sessioncookie", ""); // Get sessionvariable of Joomla-Session over the URL which passes the Joomla-Wrapper to the iframe

//Get the values out of the jos-session-table:
$session_user_id = CCDLookUp("userid","jos_session","session_id='$sessioncookie'", $conn);
$session_username = CCDLookUp("username","jos_session","session_id=' $sessioncookie'", $conn);
$session_usertype = CCDLookUp("usertype","jos_session","session_id='$sessioncookie'", $conn);
$session_usergid = CCDLookUp("gid","jos_session","session_id='$sessioncookie'", $conn);

// If there es no user logged in to Joomla, CCS-Sessionvariable are destroyed if there are some left:
if($session_usertype == "") {
CCSetSession("josGroupID", "");
CCSetSession("josUserID", "");
CCSetSession("josUserLogin", "");
}
// otherwise the current user is logged in and the Joomla-values are assigned to the CCS-sessionvariables:
else {
CCSetSession("josUserID", $session_user_id);
CCSetSession("josUserLogin", $session_username);
CCSetSession("josGroupID", $session_usergid);
}
箭頭標示處的 cldDBblog.leoshiang.com 的 blog.leoshiang.com 是在步驟一的名稱

Joomla: 模版覆寫
複製
/modules/mod_wrapper/tmpl/default.php

/templates/模版名稱/html/com_wrapper/default.php
如果 /templates/模版名稱/html/com_wrapper 目錄不存在請自行建立。

接下來,修改default.php,在 箭頭標示的位置之後加上

$session =& JFactory::getSession();
$sid = $session->getId();
往下一點的地方
src="“
改為
src="“

Joomla: 加入內嵌網頁模組
在 joomla 新增一個內嵌網頁,將 CCS 裡面的頁面網址加入。
回覆文章

回到「CodeCharge Studio」