Watajax是一个PHP和jQuery结合起来用来快速生成网页表格数据的解决方案。
示例代码:
PHP:<?php //ConnecttothedatabasefirstifyouplanonusingtheSqlversionofWatajax. require_once("lib/Watajax.class.php"); $Watajax=newWatajaxSql(); $Watajax->columns=array( "id"=>array("name"=>"#","sort_type"=>"numeric","hide"=>true), "firstname"=>array("name"=>"Firstname","transform"=>'<imgsrc="'.URI.'/images/icons/vcard.png"valign="absmiddle"/>!firstname'), "lastname"=>array("name"=>"Lastname"), "email"=>array("name"=>"E-mailadress","transform"=>'<ahref="show_reciptient.php?id=!id">!email</a>'), "tools"=>array("name"=>"","virtual"=>true,"transform"=>'<ahref="edit.php?id=!id">edit</a>')); $Watajax->run();?>
jQuery:<scripttype="text/javascript"> $(document).ready(function(){ $("#watajax_table").watajax({ajax_connector:"ajax.php",table_id:"contacts"}); })</script>
评论