2014年6月 的存档
20146 月9

CSS:限制图片最大宽度

img{max-width:800px;width:expression(this.width > 800 ? 800: true);height:auto;}

20146 月8

Nutz:下载文件(输出文件)

HSSFWorkbook wb = new HSSFWorkbook();
OutputStream out = new FileOutputStream(“x.xls”);
wb.write(out);
out.close();
return new File(“x.xls”);

 

ByteArrayOutputStream out = new ……..;
wb………
out.close();
ByteArrayInputStream in = new ………..(out.toByte…);
return in;

20146 月5

帝国CMS:头部导航栏当前栏目高亮

/e/class/userfun.php

function currentPage($classid,$thisid){
        global $class_r;
        $fr=explode('|',$class_r[$classid][featherclass]);
        $topbclassid=$fr[1]?$fr[1]:$classid;//取得第一级栏目id
        if ($topbclassid==$thisid) {
                  echo "class='cur'";
                }
        else {
        }
}

头部模板:

<ul>
<li <?php  if(empty($GLOBALS[navclassid])){echo "class='cur'";} ?>><a id="nav-hover0" href="[!--news.url--]">首页</a></li>
<?php 
$i=0;
$path="";
?>
[e:loop={'select classid,classname,classpath,wburl from [!db.pre!]enewsclass where bclassid=0 order by classid',0,24,0}]
<?php 
  $i=$i+1;
  $path=$public_r[newsurl].$bqr[classpath];
  if(!empty($bqr[wburl])){
      $path=$bqr[wburl];
  }
?>
<li <?=currentPage($GLOBALS[navclassid],$bqr[classid])?>>
<a  id="nav-hover<?=$i?>" href="<?=$path?>" title="<?=$bqr[classname]?>" target="_self" ><?=$bqr[classname]?></a>
</li>
[/e:loop]
</ul>