<?php
namespace imcat;
function na($key){
global $_cbase;
$qstr = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING'];
if($qstr==$key) echo "class='act'";
}
function uf($key){
// xxx.php -=> xxx.htm
// xxx.php?mkv -=> xxx/mkv.htm
}
// md文件存在
function hasf($key){
global $_cbase;
$fp = DIR_VIEWS."/{$_cbase['tpl']['vdir']}/$key.md";
return file_exists($fp) ? 'V' : '';
}
// md的一级标题
function htab($key, $so='', $full='0'){
global $_cbase;
$fp = DIR_VIEWS."/{$_cbase['tpl']['vdir']}/$key.md";
$data = comFiles::get($fp);
if(!$data) return '-';
preg_match_all("/\s+\#\#\# (.+)\s+/i", $data, $tmp); #\#?
if(empty($tmp[1])) return '-';
$res = implode('/', $tmp[1]); //dump($res);
$res = str_replace("\r", "", $res);
$res = str_replace($so, "<b>$so</b>", $res);
if($so){
$pos = strpos($full?$data:$res, $so);
$flag = $pos>0 ? "<b>".(strpos($res,$so)>0?'':"$so@")."</b>" : '';
}else{
$flag = '';
}
return $flag.$res;
}
/*
*/
-End-