<?php
//BeijingExtreme Project - Custom code !
//开启根目录设置,这个文件是所有页面都必须加载的
if(!isset($GLOBALS['root_path']))
{
$GLOBALS['root_path'] = dirname(__FILE__) . "/../" ;
}
if(!isset($GLOBALS['is_debug']))
{
$GLOBALS['is_debug'] = false ;
}
if(!isset($GLOBALS['root_path']))
{
$GLOBALS['root_path'] = dirname(__FILE__) . "/../" ;
}
if(!isset($GLOBALS['root_path']))
{
$GLOBALS['root_path'] = dirname(__FILE__) . "/../" ;
}
if(!isset($GLOBALS['root_path']))
{
$GLOBALS['root_path'] = dirname(__FILE__) . "/../" ;
}
/**
* 常用的辅助代码库
*
*/
class BJExtremeCommon {
function dump($vars)
{
echo "<pre>\n" . print_r($vars, true) . "\n</pre>\n";
}
/**
* 加载项目的内部文件 , 第二个参数为false,则返回
*
* @param String $path
* @return bool
*/
public function loadInterFile($path)
{
if (is_file("{$GLOBALS['root_path']}{$path}")){
include ("{$GLOBALS['root_path']}/{$path}");
return true ;
}
return false ;
}
function getInterFileContents($path) {
if (is_file("{$GLOBALS['root_path']}{$path}")){
ob_start();
include ("{$GLOBALS['root_path']}/{$path}");
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
/**
* 嵌入HTML代码段 -- 这个路径必须是相对于root_path的相对路径
* 且路径前面不要带上 "/" 字符*
* @param String $path
*/
public function incHtmlPage($path){
return $this->loadInterFile($path) ;
}
public function loadJSFile($path){
echo "<script src='$path' type='text/javascript'></script>\n";
}
public function loadCSSFile($path){
echo "<link href='$path' rel='stylesheet' type='text/css'> \n";
}
/**
* 启用指定的JS调试实现
*
* @param int $debugImpl
* @return bool
*/
public function loadJSDebug($debugImpl = 0){
if($debugImpl == 0)
return $this->loadJSFile("js/debug/nitobibug/compressed.js") ;
return NULL ;
}
/**
* 加载Jquery1.7框架
* @return bool
*/
public function loadJqueryFramework(){
$this->loadJSFile("js/jquery/jq-1.3.2.min.js") ;
}
public function loadJqueryUI(){
$this->loadJSFile("js/jquery/jqui-1.7.min.js");
$this->loadCSSFile('css/smoothness/jqui-1.7.css');
}
/**
* 生成指定XPath路径下的 DashboardGroup 样板
*
* @param String $key
*/
public function buildDashboardGroup($key) {
$dashboardArr = $this->getDashboardGroup($key);
$dashboardTemplate = $this->getInterFileContents('tpl/inc/mdintro.html') ;
if (is_array($dashboardArr)){
$tdArray = array();
foreach ($dashboardArr as $dashboard){
$dTmp = str_ireplace("#title#",$dashboard['title'],$dashboardTemplate) ;
$dTmp = str_ireplace("#description#",$dashboard['description'],$dTmp) ;
$dTmp = str_ireplace("#golink#",$dashboard['golink'],$dTmp) ;
$tdArray[] = $dTmp ;
}
echo $this->getHtmlTableFromTdArray('dashboard',$tdArray,2);
}
}
/**
* 加载 Dashboard内容数组 并返回
* 此处仅仅实现从XML文件中获取样板信息
*
* @param String $key
* @return array
*/
protected function getDashboardGroup($key='/'){
$dashboardArr = NULL ;$key=trim($key);
if (!empty($key))
{
$dashboardXMLPath = 'tpl/inc/dashboard/' ;
$dashboardArr = $this->getDashboardArrayFromXML( $dashboardXMLPath . 'root-dashboard.xml') ;
if ($key == '/'){
return $dashboardArr ;
}
else if (array_key_exists($key,$dashboardArr)) {
return $this->getDashboardArrayFromXML( $dashboardXMLPath . $dashboardArr[$key]['suburl']) ;
}
}
return $dashboardArr ;
}
/**
* 从XML文件中获取Dashboard内容 的具体实现
*
* @param String $file
* @return array
*/
private function getDashboardArrayFromXML($file){
$xmlobj = simplexml_load_file($file);
$dashboardArr = array() ;
foreach ($xmlobj->children() as $dashboard)
{
$dashboardArr["{$dashboard['name']}"] = array(
'title' => $dashboard->title .'' ,
'description' => $dashboard->description .'',
'golink' => $dashboard->golink .'' ,
'suburl' => "{$dashboard['suburl']}"
);
}
return $dashboardArr ;
}
private function getHtmlTableFromTdArray($tableID,$tdArray,$colnum){
$table = "<table id='{$tableID}'>" ;
if($colnum < 1) $colnum = 2 ;
$tr_str = "" ; $td_str = "\n" ; $ii= 1 ;
$i = 0 ;
foreach ($tdArray as $td){
$td_str .= $td ;
if ($ii == $colnum){
$tr_str .= "<tr>{$td_str}</tr>" ;
$ii = 0 ;$td_str = "\n" ;
}
if ($i == count($tdArray)-1)
$tr_str .= "<tr>{$td_str}</tr>" ;
$i ++ ; $ii ++ ;
}
$table .= $tr_str . '</table>';
return $table ;
}
/**
* 嵌入 新浪编辑器对象
*
* @param String $name
* @param int $width
* @param int $height
*/
public function incSinaEditor($input_name='content',$inputvalue='',$width='700',$height='460',$scroll='No'){
$sinaEditorTemplate = $this->getInterFileContents('tpl/inc/sinaeditor.html') ;
$sinaEditorTemplate = str_ireplace("#input_name#",$input_name,$sinaEditorTemplate) ;
//先将传入的值的' 符号置换为" , 因为模板中value用的是''
// $input_value = str_ireplace("'",'"',$input_value) ;
$input_value = htmlspecialchars($input_value) ;
$sinaEditorTemplate = str_ireplace("#input_value#",$input_value,$sinaEditorTemplate) ;
$sinaEditorTemplate = str_ireplace("#width#",$width,$sinaEditorTemplate) ;
$sinaEditorTemplate = str_ireplace("#height#",$height,$sinaEditorTemplate) ;
$sinaEditorTemplate = str_ireplace("#scroll#",$scroll,$sinaEditorTemplate) ;
echo $sinaEditorTemplate ;
}
}
?>
<div id='layout'>
<div id='leftline'></div>
<div id='interline'>
<div id='extraop'>额外的信息区域,暂备</div>
<div id='header'>
<span id='logo'></span>
<ul id='nav-pageguide'>
<li t="首页"><span id='page-home'>главная</span> <span class='spe-char'> - </span></li>
<li t="收藏本站"><span id='page-addfav'>добавить в избранное</span><span class='spe-char'> - </span></li>
<li t='设为主页'><span id='page-sethome'>cделать стартовой</span><span class='spe-char'> - </span></li>
<li t='关于我们'><span id='page-aboutus'>о компании</span></li>
</ul>
<span id='swftitle'>
<embed src="swf/top_title.swf" quality="high" type="application/x-shockwave-flash" width="450" height="50"/>
</span>
</div>
<div id='nav-topimg'>
<div class='img-border'></div>
<div id='top-img' title="准备替换的topImg图"></div>
<div class='img-border'></div>
</div>
<div id='nav-mod'>
<ul id='nav-modguidebar'>
<li t='首页'><span id='homemod'>главная</span><span class='spe-char'> > </span></li>
<li t='父模块链接'><span id='fathermod'>путешествия</span><span class='spe-char'> > </span></li>
<li t='当前模块'><span id='curmod'>тибет</span></li>
<li t='选中的action'><span id='curact'>Географическая справка</span></li>
</ul>
</div>
<div id='contenter' t='内容区域'>
<div id='action-menu'></div>
<div id='action-top'>
<span id='action-title' title="菜单标题">
</span>
<span id='action-rimg' title="右边的小图片"></span>
</div>
<div id='action-content'></div>
</div>
<div id='footer'>
<p id='copyright'>Copyright © 2006 Beijing Extreme Club. All Rights Reserved</p>
</div>
</div>
<div id='rightline'></div>
</div>
转载请注明原文地址: https://ju.6miu.com/read-1125872.html