本人是PHP初学者.- - 刚接手一家公司的网站..好多不懂.身边也没懂的人 ...>. <.. 网站之前是别人做的.看的头大,,乱糟糟的.. 打算 修改 某个网页 . 却发现找不到 .. 具体 网址是www.xhqh.com/index.php?act=dept 修改 右侧的几个部门介绍页面
地址是 www.xhqh.com/index.php?act=dept&code=view&id=**.
该页面view_dept.html 写的是 td style="vertical-align:top"><div align="left"> {Descript} </div></td>
还一个事list_dept.html 写的是 <!-- beginRow RowList -->
<tr>
<td>·<a href="{CURRENT_MODULE}&code=view&id={RowList.ID}" target="_blank">{RowList.DeptName}</a></td>
</tr>
<!-- endRow RowList -->
dept.php 写的是
defined('__ZHAZHA_FRAMEWORK__') or die('Access deny.');//include this module operate logic, if exists
require SYS_LOGIC_DIR . 'Dept' . PHP_EXT;$GLOBALS['CurrentModule'] = '部门列表';
class ManagerUI
{
function __constructor()
{
$this->ManagerUI();
}
function ManagerUI()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$tpl->setFile('main', 'main.html'); switch($in['code'])
{
case 'view':
$methodRet = $this->doView();
break;
default:
$methodRet = $this->doDefaultHandle();
}
$tpl->setCurrentfile('main');
$tpl->setVar('Data', $methodRet);
$pfcKernel['out']->addOutput($tpl->parse('main'));
} //default handle for this module, by default this is list data.
function doDefaultHandle()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$config = &$pfcKernel['__setting'];
$tpl->setVar('Position', ' > <a href="' . CURRENT_MODULE . '">' . $GLOBALS['CurrentModule'] . '</a>');
$tpl->setFile('list_dept', 'list_dept.html');
$Depts = new Dept_Logic();
$page = !isset($in['page']) || (int)$in['page'] < 1 ? 1 : (int)$in['page'];
$pageSize = !empty($in['pageSize']) ? (int)$in['pageSize'] : 20; if($pageSize == 0 && $pageSize != -1) $pageSize = 20;
$orderField = !empty($in['orderField']) ? $in['orderField'] : 'ID';
if(!isset($in['orderMode'])) $orderMode = ORDER_DESC;
else $orderMode = isset($in['orderMode']) && $in['orderMode'] ? ORDER_DESC : ORDER_ASC;
//if in search, set the list condition
$oldterm = $term = '1=1';
if(!empty($in['Keyword'])) $in['DeptName'] = $in['Keyword'];
if(!empty($in['DeptName'])) $term .= " and DeptName like '%" . $in['DeptName'] . "%'";
if($term == $oldterm) $tpl->setVar('LANG_showall', '');
$recordCount = $Depts->getCount($term);
$pageCount = ceil($recordCount / $pageSize);
$showFields = array('ID', 'DeptName', 'Descript'); $list = $Depts->getList($term, ($page - 1) * $pageSize, $pageSize, $orderField, $orderMode, $showFields);
// $tpl->setVar('PAGE_LIST', showPages($page, $pageCount, $recordCount, $pageSize));
/*
function deptCallbackFunc(&$arr)
{
}
*/
$tpl->simpleBlock('list_dept', 'RowList', $list/*, 'deptCallbackFunc'*/);
return $tpl->parse('list_dept');
} //modify items
function doView()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$config = $pfcKernel['__setting']; $Depts = new Dept_Logic();
$Dept = $Depts->getItem('ID', (int)$in['id']); if(empty($in['id']) || !$Dept || $Dept['ID'] != $in['id'])
{
showError(getLangItem('LANG_item_notexists'));
}
$tpl->setFile('view', 'view_dept.html');
$tpl->setVar($Dept);
//convert data to need from orginal, if exists.
return $tpl->parse('view');
}
}new ManagerUI();
?>
地址是 www.xhqh.com/index.php?act=dept&code=view&id=**.
该页面view_dept.html 写的是 td style="vertical-align:top"><div align="left"> {Descript} </div></td>
还一个事list_dept.html 写的是 <!-- beginRow RowList -->
<tr>
<td>·<a href="{CURRENT_MODULE}&code=view&id={RowList.ID}" target="_blank">{RowList.DeptName}</a></td>
</tr>
<!-- endRow RowList -->
dept.php 写的是
defined('__ZHAZHA_FRAMEWORK__') or die('Access deny.');//include this module operate logic, if exists
require SYS_LOGIC_DIR . 'Dept' . PHP_EXT;$GLOBALS['CurrentModule'] = '部门列表';
class ManagerUI
{
function __constructor()
{
$this->ManagerUI();
}
function ManagerUI()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$tpl->setFile('main', 'main.html'); switch($in['code'])
{
case 'view':
$methodRet = $this->doView();
break;
default:
$methodRet = $this->doDefaultHandle();
}
$tpl->setCurrentfile('main');
$tpl->setVar('Data', $methodRet);
$pfcKernel['out']->addOutput($tpl->parse('main'));
} //default handle for this module, by default this is list data.
function doDefaultHandle()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$config = &$pfcKernel['__setting'];
$tpl->setVar('Position', ' > <a href="' . CURRENT_MODULE . '">' . $GLOBALS['CurrentModule'] . '</a>');
$tpl->setFile('list_dept', 'list_dept.html');
$Depts = new Dept_Logic();
$page = !isset($in['page']) || (int)$in['page'] < 1 ? 1 : (int)$in['page'];
$pageSize = !empty($in['pageSize']) ? (int)$in['pageSize'] : 20; if($pageSize == 0 && $pageSize != -1) $pageSize = 20;
$orderField = !empty($in['orderField']) ? $in['orderField'] : 'ID';
if(!isset($in['orderMode'])) $orderMode = ORDER_DESC;
else $orderMode = isset($in['orderMode']) && $in['orderMode'] ? ORDER_DESC : ORDER_ASC;
//if in search, set the list condition
$oldterm = $term = '1=1';
if(!empty($in['Keyword'])) $in['DeptName'] = $in['Keyword'];
if(!empty($in['DeptName'])) $term .= " and DeptName like '%" . $in['DeptName'] . "%'";
if($term == $oldterm) $tpl->setVar('LANG_showall', '');
$recordCount = $Depts->getCount($term);
$pageCount = ceil($recordCount / $pageSize);
$showFields = array('ID', 'DeptName', 'Descript'); $list = $Depts->getList($term, ($page - 1) * $pageSize, $pageSize, $orderField, $orderMode, $showFields);
// $tpl->setVar('PAGE_LIST', showPages($page, $pageCount, $recordCount, $pageSize));
/*
function deptCallbackFunc(&$arr)
{
}
*/
$tpl->simpleBlock('list_dept', 'RowList', $list/*, 'deptCallbackFunc'*/);
return $tpl->parse('list_dept');
} //modify items
function doView()
{
global $pfcKernel;
$in = &$pfcKernel['in'];
$tpl = &$pfcKernel['tpl'];
$config = $pfcKernel['__setting']; $Depts = new Dept_Logic();
$Dept = $Depts->getItem('ID', (int)$in['id']); if(empty($in['id']) || !$Dept || $Dept['ID'] != $in['id'])
{
showError(getLangItem('LANG_item_notexists'));
}
$tpl->setFile('view', 'view_dept.html');
$tpl->setVar($Dept);
//convert data to need from orginal, if exists.
return $tpl->parse('view');
}
}new ManagerUI();
?>
比如在PHPCMS和DISCUZ中就可以找到很多HTML文件
我只能告诉你的$tpl是一个模板调用类 用于读取模板数据和替换模板内容的
这应该不是你那位同事的原创 应该是在网上找的现成类至于数据是如何对应的 你可以用DW或是其他编辑软件的搜索功能 搜索含有如 {Descript}/{RowList.ID} 这样的标签的文件 你就知道了
关于模板操作方面 我也曾写过一些相关的函数 要是楼主有兴趣 我可以共享出来一起研究
在源码里边就可以找到后台
一般为admin之类的文件夹里边