主题: phpcms 编辑器更换成KindEditor后,宽度怎么设置? |
作者: qqeer, 发布日期: 2013-02-28 15:59:54, 浏览数: 10118 |
phpcms 的编辑器更换成KindEditor后,默认宽度成这样了(如图),请问怎么设置宽度?
|
作者: 小浪子, 发布日期: 2013-02-28 16:03:33 |
你可以把编辑器不设置宽度高度。。设置文本域的宽度高度就行了。
|
回复 |
作者: qqeer, 发布日期: 2013-02-28 16:18:36 |
回复小浪子: 编辑器没有设置宽度和高度啊。另外群怎么都不能加入啊?
|
回复 |
作者: 小浪子, 发布日期: 2013-02-28 16:20:37 |
回复qqeer:我又不是管理。哪里知道群能不能加哦。。。 你把生成后的html贴上来看看。 |
回复 |
作者: qqeer, 发布日期: 2013-02-28 16:35:09 |
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gbk"> <title>好好好-发布</title> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link href="admin/skin/system.css" rel="stylesheet" type="text/css"> <script type="text/javaScript" src="data/config.js"></script> <script type="text/javaScript" src="images/js/jquery.min.js"></script> <script type="text/javaScript" src="images/js/css.js"></script> <script type="text/javaScript" src="images/js/common.js"></script> <script type="text/javaScript" src="images/js/admin.js"></script> <script type="text/javascript" src="images/js/validator.js"></script> <script type="text/javascript" src="images/js/form.js"></script> </head> <script type="text/javascript" src="images/js/form.js"></script> <script type="text/javascript" src="images/js/jqModal.js"></script> <script type="text/javascript" src="images/js/jqDnR.js"></script> <body> <table cellpadding="0" cellspacing="1" class="table_form"> <caption>好好好 栏目管理</caption> <tr> <td><a href='?mod=phpcms&file=content&action=add&catid=32' ><font color="red">发布信息</font></a> | <a href='?mod=phpcms&file=content&action=my&catid=32' >我发布的信息</a> | <a href='?mod=phpcms&file=content&action=check&catid=32&processid=1&status=3' >审核</a> | <a href='?mod=phpcms&file=content&action=manage&catid=32' >管理</a> | <a href='?mod=phpcms&file=content&action=recycle&catid=32' >回收站</a> | <a href='?mod=phpcms&file=content&action=block&catid=32' >碎片</a> | <a href='?mod=phpcms&file=content&action=search&catid=32' >搜索</a></td> </tr> </table><div class="tag_menu" style="width:99%;margin-top:10px;"> <ul> <li><a href="###" id='TabTitle0' onclick='ShowTabs(0)' class="selected">基本信息</a></li> <li><a href="###" id='TabTitle1' onclick='ShowTabs(1)'>高级设置</a></li> </ul></div> <form action="?mod=phpcms&file=content&action=add&catid=32&modelid=1" method="post" name="myform" enctype="multipart/form-data"> <div id='Tabs0' style='display:'> <input type="hidden" name="dosubmit" value="1" /> <table cellpadding="0" cellspacing="1" class="table_form"> <caption>基本信息</caption> <tr> <th width="20%"> <font color="red">*</font> <strong>栏目</strong> <br /> </th> <td><select name="info[catid]" id="catid"><option value="31" >呵呵</option><option value="32" selected>好好好</option></select><input type="hidden" name="old_catid" value="32"> <a href='' class="jqModal" onclick="$('.jqmWindow').show();"/> [同时发布到其他栏目]</a> </td> </tr> <tr> <th width="20%"> <strong>类别</strong> <br /> </th> <td><select name='info[typeid]' id='typeid' > <option value='0'>请选择</option> </select> </td> </tr> <tr> <th width="20%"> <strong>地区</strong> <br /> </th> <td><input type="hidden" name="info[areaid]" id="areaid" value=""> <span id="load_areaid"></span> <a href="javascript:area_reload();">重选</a><script type="text/javascript"> function area_load(id) { $.get('load.php', { field: 'areaid', id: id, value: 'areaid' }, function(data){ $('#load_areaid').append(data); }); } function area_reload() { $('#load_areaid').html(''); area_load(0); } area_load(0); </script> </td> </tr> <tr> <th width="20%"> <font color="red">*</font> <strong>标题</strong> <br /> </th> <td><input type="text" name="info[title]" id="title" value="" size="80" class="inputtitle" require="true" datatype="limit" min="1" max="80" msg='字符长度必须为1到80位' onBlur="$.post('api/get_keywords.php?number=3&sid='+Math.random()*5, {data:$('#title').val()}, function(data){if(data) $('#keywords').val(data); })"/> <input type="button" value="检测标题是否已存在" onclick="$.post('?mod=phpcms&file=content&catid=32', { action : 'check_title', c_title:$('#title').val()}, function(data){ $('#t_msg').html(data); })"> <span style="color:'#ff0000'" id='t_msg'></span> </td> </tr> <tr> <th width="20%"> <strong>颜色和字型</strong> <br /> </th> <td><select name="style_color1" id="style_color1" onchange="document.all.style_id1.value=document.all.style_color1.value;if(document.all.style_strong1.checked)document.all.style_id1.value += ' '+document.all.style_strong1.value;"> <option value="">颜色</option> <option value="c1" class="bg1"></option> <option value="c2" class="bg2"></option> <option value="c3" class="bg3"></option> <option value="c4" class="bg4"></option> <option value="c5" class="bg5"></option> <option value="c6" class="bg6"></option> <option value="c7" class="bg7"></option> <option value="c8" class="bg8"></option> <option value="c9" class="bg9"></option> <option value="c10" class="bg10"></option> <option value="c11" class="bg11"></option> <option value="c12" class="bg12"></option> <option value="c13" class="bg13"></option> <option value="c14" class="bg14"></option> <option value="c15" class="bg15"></option> </select> <label><input type="checkbox" name="style_strong1" id="style_strong1" value="b" onclick="document.all.style_id1.value=document.all.style_color1.value;if(document.all.style_strong1.checked)document.all.style_id1.value += ' '+document.all.style_strong1.value;"> 加粗</label><input type="hidden" name="info[style]" id="style_id1" value=""> </td> </tr> <tr> <th width="20%"> <strong>缩略图</strong> <br /> </th> <td><input type="text" name="info[thumb]" id="thumb" value="" size="50" class="" /> <input type="hidden" name="thumb_aid" id="thumb_aid" value="0"> <input type="button" name="thumb_upimage" id="thumb_upimage" value="上传图片" style="width:60px" onclick="javascript:openwinx('?mod=phpcms&file=upload_field&uploadtext=thumb&modelid=1&catid=32&fieldid=8','upload','450','350')"/> <input type='button' value='浏览...' style='cursor:pointer;' onclick="file_select('thumb', 32, 1)"> <input name="cutpic" type="button" id="cutpic" value="裁剪图片" onclick="CutPic('thumb','http://127.0.0.1/')"/> </td> </tr> <tr> <th width="20%"> <strong>关键词</strong> <br /> 多关键词之间用空格隔开 </th> <td><input type="" name="info[keywords]" id="keywords" value="" size="50" class="" /> <select name='select_keyword' onchange="if($('#keywords').val()==''){ $('#keywords').val(this.value);}else if($('#keywords').val().indexOf(this.value)==-1){ $('#keywords').val($('#keywords').val()+' '+this.value);}" style='width:85px'><option>常用关键词</option></select> <a href="###" onclick="SelectKeyword();">更多>></a> </td> </tr> <tr> <th width="20%"> <strong>作者</strong> <br /> </th> <td><input type="text" name="info[author]" id="author" value="" size="30" class="" /> <select name="" onchange="$('#author').val(this.value)" style="width:75px"><option>常用作者</option></select> <a href="###" onclick="SelectAuthor();">更多>></a> </td> </tr> <tr> <th width="20%"> <strong>来源</strong> <br /> </th> <td><input type="" name="info[copyfrom]" id="copyfrom" value="" size="30" class="" /> <select name="select_copyfrom" onchange="$('#copyfrom').val(this.value)" style="width:75px"><option>常用来源</option></select> <a href="###" onclick="SelectCopyfrom();">更多>></a> </td> </tr> <tr> <th width="20%"> <strong>摘要</strong> <br /> </th> <td> <img src="images/icon.gif" width="12"> 还可以输入 <font id="ls_description" color="#ff0000;">255</font> 个字符!<br /><textarea name="info[description]" id="description" rows="4" cols="50" class="" style="width:80%" onkeyup="checkLength(this, 'description', '255');"></textarea> </td> </tr> <tr> <th width="20%"> <font color="red">*</font> <strong>内容</strong> <br /> <label><input name="add_introduce" type="checkbox" value="1" checked>是否截取内容</label><br><input type="text" name="introcude_length" value="200" size="3">字符至内容摘要 <br/><br/> <label><input type='checkbox' name='auto_thumb' value="1" checked>是否获取内容第</label><br><input type="text" name="auto_thumb_no" value="1" size="2" class="">张图片作为标题图片 </th> <td><textarea name="info[content]" id="content" ></textarea> <script charset="utf-8" type="text/javascript" src="images/js/kindeditor/kindeditor-min.js"></script><script charset="utf-8" type="text/javascript" src="images/js/kindeditor/lang/zh_CN.js"></script><script type="text/javascript"> KindEditor.ready(function(K) { editor = K.create('textarea[id="content"]', { allowFileManager : true });});</script><div style='width:100%;text-align:left'><span style='float:right;height:22px'><span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><a href='javascript:insert_page("content")' title='在光标处插入分页标记'>分页</a></span><span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><a href='javascript:insert_page_title("content")' title='在光标处插入带子标题的分页标记'>子标题</a></span><span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><div id='page_title_div' style='background-color: #fff;border:#006699 solid 1px;position:absolute;z-index:10;padding:1px;display:none;right:80px;'> <table cellpadding='0' cellspacing='1' border='0'><tr><td >请输入子标题名称:<span id='msg_page_title_value'></span></td><td><span style='cursor:pointer;float:right;' onclick='javascript:$("#page_title_div").hide()'>×</span></td> <tr><td colspan='2'><input name='page_title_value' id='page_title_value' value='' size='40'> <input type='button' value=' 确定 ' onclick=insert_page_title("content",1)></td></tr> </table></span></div><span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><div id='content_div' style='background-color: #fff;border:#006699 solid 1px;position:absolute;z-index:10;padding:5px;display:none;right:60px;'> <table cellpadding='0' cellspacing='1' border='0'><tr><td> <div><a href='javascript:get_editor_data_list("content",1)' class='hour' style='border:#cccccc solid 1px;margin:2px;padding-left:4px;padding-right:4px;font-weight: bold;' title='1 小时'>1</a><a href='javascript:get_editor_data_list("content",2)' class='hour' style='border:#cccccc solid 1px;margin:2px;padding-left:4px;padding-right:4px;' title='2 小时'>2</a><a href='javascript:get_editor_data_list("content",3)' class='hour' style='border:#cccccc solid 1px;margin:2px;padding-left:4px;padding-right:4px;' title='3 小时'>3</a><a href='javascript:get_editor_data_list("content",4)' class='hour' style='border:#cccccc solid 1px;margin:2px;padding-left:4px;padding-right:4px;' title='4 小时'>4</a></div></td><td><span style='cursor:pointer;' onclick='javascript:$("#content_div").hide()'>×</span></td></tr></table><ul id='content_lists' style='height:200px;width:140px;overflow:auto;'></ul></div><a href='javascript:get_editor_data_list("content",1)' title='点击恢复数据'>恢复数据</a></span></span><img src="http://127.0.0.1/images/editor_add.jpg" title='增加编辑器高度' tag='1' fck="content"/> <img src="http://127.0.0.1/images/editor_diff.jpg" title='减少编辑器高度' tag='0' fck="content"/></div><div id="MM_file_list_content" style="text-align:left"></div><div id='FilePreview' style='Z-INDEX: 1000; LEFT: 0px; WIDTH: 10px; POSITION: absolute; TOP: 0px; HEIGHT: 10px; display: none;'></div><div id='content_save'></div> </td> </tr> <tr> <th width="20%"> <strong>分页方式</strong> <br /> </th> <td><select name="info[paginationtype]" id="paginationtype" onchange="if(this.value==1)paginationtype1.style.display=''; else paginationtype1.style.display='none';"> <option value="0">不分页</option> <option value="1">自动分页</option> <option value="2">手动分页</option> </select> <strong><font color="#0000FF">注:</font></strong><font color="#0000FF">手动分页时,将光标放在需要分页处,点编辑器下面的“</font> 分页 <font color="#0000FF">”即可。点击“</font> 子标题 <font color="#0000FF">”可以设置每篇分页的标题。</font> <div id="paginationtype1" style="display:none">自动分页时的每页大约字符数(包含HTML标记)<strong> <input name="info[maxcharperpage]" type="text" id="maxcharperpage" value="10000" size="8" maxlength="8"></strong></div> </td> </tr> <tr> <th width="20%"><strong>状态</strong><br /> </th> <td> <label><input type="radio" name="status" value="99" checked/> 发布</label> <label><input type="radio" name="status" value="3" > 审核</label> <label><input type="radio" name="status" value="2"> 草稿</label> </td> </tr> <tr> <td></td> <td> <input type="hidden" name="forward" value="http://127.0.0.1/admin.php?mod=phpcms&file=content&action=manage&catid=32"> <input type="submit" name="dosubmit" value=" 确定 "> <input type="button" name="preview" value=" 预览 " onclick="preview_content();"> <input type="reset" name="reset" value=" 清除 "> </td> </tr> </table> </div> <div id='Tabs1' style='display:none'> <table cellpadding="0" cellspacing="1" class="table_form"> <caption>高级设置</caption> <tr> <th width="20%"> <strong>完整标题</strong> <br /> </th> <td><input type="text" name="info[titleintact]" id="titleintact" value="" size="80" class="" require="false" datatype="limit" min="0" max="200" msg='字符长度必须为0到200位' /> </td> </tr> <tr> <th width="20%"> <strong>转向链接</strong> <br /> </th> <td><input type="hidden" name="info[islink]" value="99"><input type="text" name="info[linkurl]" id="linkurl" value="" size="50" maxlength="255" disabled> <font color="#FF0000"><label><input name="info[islink]" type="checkbox" id="islink" value="1" onclick="ruselinkurl();" > 转向链接</label></font><br/><font color="#FF0000">如果使用转向链接则点击标题就直接跳转而内容设置无效</font> </td> </tr> <tr> <th width="20%"> <strong>发布时间</strong> <br /> </th> <td><link rel="stylesheet" type="text/css" href="images/js/calendar/calendar-blue.css"/> <script type="text/javascript" src="images/js/calendar/calendar.js"></script><input type="text" name="info[inputtime]" id="inputtime" value="2013-02-28 16:23:33" size="21" readonly> <script language="javascript" type="text/javascript"> date = new Date();document.getElementById ("inputtime").value="2013-02-28 16:23:33"; Calendar.setup({ inputField : "inputtime", ifFormat : "%Y-%m-%d %H:%M:%S", showsTime : true, timeFormat : "24" }); </script> </td> </tr> <tr> <th width="20%"> <strong>推荐位</strong> <br /> 全选<input boxid='posids' type='checkbox' onclick="checkall('posids')" > </th> <td><input type="hidden" name="info[posids]" value="-99"><span style="width:125px"><label><input type="checkbox" boxid="posids" name="info[posids][]" id="posids" value="1" style="border:0px" /> 首页推荐</label></span> <span style="width:125px"><label><input type="checkbox" boxid="posids" name="info[posids][]" id="posids" value="2" style="border:0px" /> 首页焦点</label></span> <span style="width:125px"><label><input type="checkbox" boxid="posids" name="info[posids][]" id="posids" value="3" style="border:0px" /> 首页头条</label></span> <span style="width:125px"><label><input type="checkbox" boxid="posids" name="info[posids][]" id="posids" value="4" style="border:0px" /> 列表页推荐</label></span> <br /> <span style="width:125px"><label><input type="checkbox" boxid="posids" name="info[posids][]" id="posids" value="5" style="border:0px" /> 内容页推荐</label></span> </td> </tr> <tr> <th width="20%"> <strong>阅读权限</strong> <br /> 全选<input boxid='groupids_view' type='checkbox' onclick="checkall('groupids_view')" > </th> <td><input type="hidden" name="info[groupids_view]" value="-99"><span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="1" style="border:0px" /> 管理员</label></span> <span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="2" style="border:0px" /> 禁用</label></span> <span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="3" style="border:0px" /> 游客</label></span> <span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="4" style="border:0px" /> 待邮件验证</label></span> <br /> <span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="5" style="border:0px" /> 待审核</label></span> <span style="width:125px"><label><input type="checkbox" boxid="groupids_view" name="info[groupids_view][]" id="groupids_view" value="6" style="border:0px" /> 注册会员</label></span> </td> </tr> <tr> <th width="20%"> <strong>阅读所需点数</strong> <br /> </th> <td><input type="text" name="info[readpoint]" id="readpoint" value="" size="10" class="" require="false" datatype="limit" min="0" max="5" msg='字符长度必须为0到5位' /> </td> </tr> <tr> <th width="20%"> <strong>html文件名</strong> <br /> </th> <td><input type="text" name="info[prefix]" id="prefix" value="" size="20" class="" require="false" datatype="limit" min="0" max="20" msg='字符长度必须为0到20位' /> </td> </tr> <tr> <th width="20%"> <strong>内容页模板</strong> <br /> </th> <td><select name="info[template]" id="template" ><option value="" >请选择</option> <option value="show" selected>文章内容页(show.html)</option> <option value="show_down" >下载内容页(show_down.html)</option> <option value="show_info" >信息内容页(show_info.html)</option> <option value="show_ku6" >(show_ku6.html)</option> <option value="show_picture" >图片内容页(show_picture.html)</option> <option value="show_product" >产品内容页(show_product.html)</option> <option value="show_video" >视频内容页(show_video.html)</option> <option value="showmessage" >提示信息(showmessage.html)</option> </select> </td> </tr> <tr> <td></td> <td> <input type="hidden" name="forward" value="http://127.0.0.1/admin.php?mod=phpcms&file=content&action=manage&catid=32"> <input type="submit" name="dosubmit" value=" 确定 "> <input type="button" name="preview" value=" 预览 " onclick="preview_content();"> <input type="reset" name="reset" value=" 清除 "> </td> </tr> </table> </div> <div class="jqmWindow"> <h5 class="title" style="cursor:move"><a href="#" class="jqmClose"><img src="images/close.gif" alt="" height="16px" width="16px" /></a>同时发布到其他栏目</h5> <div id="protocol" style="height:300px;overflow:auto;"> <table cellpadding="0" cellspacing="1" class="table_list"> <caption>请选择栏目</caption> <tr><td style='height:22px;padding:0 0 0 10px;'>呵呵</td><td><input type="checkbox" name="cat_selected[]" value="31"></td></tr><tr><td style='height:22px;padding:0 0 0 10px;'>好好好</td><td><input type="checkbox" name="cat_selected[]" value="32"></td></tr><tr> <td></td><td><input type="button" value="确定" id="ok" onclick="$('.jqmWindow').hide();" style="width:60px"></td> </tr> </table> </div> </div> </form> <script LANGUAGE="javascript"> <!-- function preview_content() { myform.action = "preview.php"; myform.target = "_blank"; myform.submit(); myform.action = "?mod=phpcms&file=content&action=add&catid=32&modelid=1"; myform.target="_self"; } $().ready(function() { $('form').checkForm(1); $('.jqmWindow').jqm({overlay: 0 }).jqDrag('.title'); }); //--> </script> </body> </html> |
回复 |
作者: 小浪子, 发布日期: 2013-02-28 16:40:29 |
回复qqeer: <textarea name="info[content]" id="content" ></textarea>
你设置下宽度和高度啊
如: <textarea name="info[content]" id="content" style="width:98%; height:350px;"></textarea>
|
回复 |
作者: qqeer, 发布日期: 2013-02-28 16:59:37 |
<?php class form { function editor($textareaid = 'content', $toolbar = 'standard', $width = '100%', $height = 400, $isshowext = 1) { global $PHPCMS, $mod, $file, $catid, $_userid; $str .= '<script charset="utf-8" type="text/javascript" src="images/js/kindeditor/kindeditor-min.js"></script>'; $str .= '<script charset="utf-8" type="text/javascript" src="images/js/kindeditor/lang/zh_CN.js"></script>'; define('EDITOR_INIT', 1); $str .= "<script type=\"text/javascript\">\r\n"; $str .= "KindEditor.ready(function(K) {\r\n"; $str .= "editor = K.create('textarea[id=\"$textareaid\"]', {\r\n"; $str .= "allowFileManager : true\r\n"; $str .= "});"; $str .= "});"; $str .= '</script>'; if($isshowext) { $str .= "<div style='width:$width;text-align:left'>"; if($_userid) { $str .= "<span style='float:right;height:22px'>"; if(defined('IN_ADMIN') && $mod == 'phpcms' && $file == 'content') { $str .= "<span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><a href='javascript:insert_page(\"$textareaid\")' title='在光标处插入分页标记'>分页</a></span>"; $str .= "<span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><a href='javascript:insert_page_title(\"$textareaid\")' title='在光标处插入带子标题的分页标记'>子标题</a></span>"; } $str .= "<span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><div id='page_title_div' style='background-color: #fff;border:#006699 solid 1px;position:absolute;z-index:10;padding:1px;display:none;right:80px;'> <table cellpadding='0' cellspacing='1' border='0'><tr><td >请输入子标题名称:<span id='msg_page_title_value'></span></td><td><span style='cursor:pointer;float:right;' onclick='javascript:$(\"#page_title_div\").hide()'>×</span></td> <tr><td colspan='2'><input name='page_title_value' id='page_title_value' value='' size='40'> <input type='button' value=' 确定 ' onclick=insert_page_title(\"$textareaid\",1)></td></tr> </table></span></div>"; $str .= "<span style='padding:1px;margin-right:10px;background-color: #fefe;border:#006699 solid 1px;'><div id='".$textareaid."_div' style='background-color: #fff;border:#006699 solid 1px;position:absolute;z-index:10;padding:5px;display:none;right:60px;'> <table cellpadding='0' cellspacing='1' border='0'><tr><td> <div>"; for($i=1; $i<=$PHPCMS['editor_max_data_hour']; $i++) { $bold = $i==1 ? "font-weight: bold;" : ''; $str .= "<a href='javascript:get_editor_data_list(\"".$textareaid."\",$i)' class='hour' style='border:#cccccc solid 1px;margin:2px;padding-left:4px;padding-right:4px;$bold' title='$i 小时'>$i</a>"; } $str .= "</div></td><td><span style='cursor:pointer;' onclick='javascript:$(\"#".$textareaid."_div\").hide()'>×</span></td></tr></table><ul id='".$textareaid."_lists' style='height:200px;width:140px;overflow:auto;'></ul></div><a href='javascript:get_editor_data_list(\"".$textareaid."\",1)' title='点击恢复数据'>恢复数据</a></span></span>"; } $str .= "<img src=\"".SITE_URL."images/editor_add.jpg\" title='增加编辑器高度' tag='1' fck=\"".$textareaid."\"/> <img src=\"".SITE_URL."images/editor_diff.jpg\" title='减少编辑器高度' tag='0' fck=\"".$textareaid."\"/></div>"; } $str .= "<div id=\"MM_file_list_".$textareaid."\" style=\"text-align:left\"></div><div id='FilePreview' style='Z-INDEX: 1000; LEFT: 0px; WIDTH: 10px; POSITION: absolute; TOP: 0px; HEIGHT: 10px; display: none;'></div><div id='".$textareaid."_save'></div>"; return $str; } function date($name, $value = '', $isdatetime = 0) { if($value == '0000-00-00 00:00:00') $value = ''; $id = preg_match("/\[(.*)\]/", $name, $m) ? $m[1] : $name; if($isdatetime) { $size = 21; $format = '%Y-%m-%d %H:%M:%S'; $showsTime = 'true'; } else { $size = 10; $format = '%Y-%m-%d'; $showsTime = 'false'; } $str = ''; if(!defined('CALENDAR_INIT')) { define('CALENDAR_INIT', 1); $str .= '<link rel="stylesheet" type="text/css" href="images/js/calendar/calendar-blue.css"/> <script type="text/javascript" src="images/js/calendar/calendar.js"></script>'; } $str .= '<input type="text" name="'.$name.'" id="'.$id.'" value="'.$value.'" size="'.$size.'" readonly> '; $str .= '<script language="javascript" type="text/javascript"> date = new Date();document.getElementById ("'.$id.'").value="'.$value.'"; Calendar.setup({ inputField : "'.$id.'", ifFormat : "'.$format.'", showsTime : '.$showsTime.', timeFormat : "24" }); </script>'; return $str; } function checkcode($name = 'checkcode', $size = 4, $extra = '') { return '<input name="'.$name.'" id="'.$name.'" type="text" size="'.$size.'" '.$extra.' style="ime-mode:disabled;"> <img src="'.SITE_URL.'checkcode.php" id="checkcode" onclick="this.src=\''.SITE_URL.'checkcode.php?id=\'+Math.random()*5;" style="cursor:pointer;" alt="验证码,看不清楚?请点击刷新验证码" align="absmiddle"/>'; } function style($name = 'style', $style = '') { global $styleid, $LANG; if(!$styleid) $styleid = 1; else $styleid++; $color = $strong = ''; if($style) { list($color, $b) = explode(' ', $style); } $styleform = "<option value=\"\">".$LANG['color']."</option>\n"; for($i=1; $i<=15; $i++) { $styleform .= "<option value=\"c".$i."\" ".($color == 'c'.$i ? "selected=\"selected\"" : "")." class=\"bg".$i."\"></option>\n"; } $styleform = "<select name=\"style_color$styleid\" id=\"style_color$styleid\" onchange=\"document.all.style_id$styleid.value=document.all.style_color$styleid.value;if(document.all.style_strong$styleid.checked)document.all.style_id$styleid.value += ' '+document.all.style_strong$styleid.value;\">\n".$styleform."</select>\n"; $styleform .= " <label><input type=\"checkbox\" name=\"style_strong$styleid\" id=\"style_strong$styleid\" value=\"b\" ".($b == 'b' ? "checked=\"checked\"" : "")." onclick=\"document.all.style_id$styleid.value=document.all.style_color$styleid.value;if(document.all.style_strong$styleid.checked)document.all.style_id$styleid.value += ' '+document.all.style_strong$styleid.value;\"> ".$LANG['bold']; $styleform .= "</label><input type=\"hidden\" name=\"".$name."\" id=\"style_id$styleid\" value=\"".$style."\">"; return $styleform; } function text($name, $id = '', $value = '', $type = 'text', $size = 50, $class = '', $ext = '', $minlength = '', $maxlength = '', $pattern = '', $errortips = '') { if(!$id) $id = $name; $checkthis = ''; $showerrortips = "字符长度必须为".$minlength."到".$maxlength."位"; if($pattern) { $pattern = 'regexp="'.substr($pattern,1,-1).'"'; } $require = $minlength ? 'true' : 'false'; if($pattern && ($minlength || $maxlength)) { $string_datatype = substr($string_datatype, 1); $checkthis = "require=\"$require\" $pattern datatype=\"limit|custom\" min=\"$minlength\" max=\"$maxlength\" msg='$showerrortips|$errortips'"; } elseif($pattern) { $checkthis = "require=\"$require\" $pattern datatype=\"custom\" msg='$errortips'"; } elseif($minlength || $maxlength) { $checkthis = "require=\"$require\" datatype=\"limit\" min=\"$minlength\" max=\"$maxlength\" msg='$showerrortips'"; } return "<input type=\"$type\" name=\"$name\" id=\"$id\" value=\"$value\" size=\"$size\" class=\"$class\" $checkthis $ext/> "; } function textarea($name, $id = '', $value = '', $rows = 10, $cols = 50, $class = '', $ext = '', $character = 0, $maxlength = 0) { if(!$id) $id = $name; if($character && $maxlength) { $data = ' <img src="images/icon.gif" width="12"> 还可以输入 <font id="ls_'.$id.'" color="#ff0000;">'.$maxlength.'</font> 个字符!<br />'; } $data .= "<textarea name=\"$name\" id=\"$id\" rows=\"$rows\" cols=\"$cols\" class=\"$class\" $ext>$value</textarea>"; return $data; } function select($options, $name, $id = '', $value = '', $size = 1, $class = '', $ext = '') { if(!$id) $id = $name; if(!is_array($options)) $options = form::_option($options); if($size >= 1) $size = " size=\"$size\""; if($class) $class = " class=\"$class\""; $data .= "<select name=\"$name\" id=\"$id\" $size $class $ext>"; foreach($options as $k=>$v) { $selected = $k == $value ? 'selected' : ''; $data .= "<option value=\"$k\" $selected>$v</option>\n"; } $data .= '</select>'; return $data; } function multiple($options, $name, $id = '', $value = '', $size = 3, $class = '', $ext = '') { if(!$id) $id = $name; if(!is_array($options)) $options = form::_option($options); $size = max(intval($size), 3); if($class) $class = " class=\"$class\""; $value = strpos($value, ',') ? explode(',', $value) : array($value); $data .= "<select name=\"$name\" id=\"$id\" multiple=\"multiple\" size=\"$size\" $class $ext>"; foreach($options as $k=>$v) { $selected = in_array($k, $value) ? 'selected' : ''; $data .= "<option value=\"$k\" $selected>$v</option>\n"; } $data .= '</select>'; return $data; } function checkbox($options, $name, $id = '', $value = '', $cols = 5, $class = '', $ext = '', $width = 100) { if(!$options) return ''; if(!$id) $id = $name; if(!is_array($options)) $options = form::_option($options); $i = 1; $data = '<input type="hidden" name="'.$name.'" value="-99">'; if($class) $class = " class=\"$class\""; if($value != '') $value = strpos($value, ',') ? explode(',', $value) : array($value); foreach($options as $k=>$v) { $checked = ($value && in_array($k, $value)) ? 'checked' : ''; $data .= "<span style=\"width:{$width}px\"><label><input type=\"checkbox\" boxid=\"{$id}\" name=\"{$name}[]\" id=\"{$id}\" value=\"{$k}\" style=\"border:0px\" $class {$ext} {$checked}/> {$v}</label></span>\n "; if($i%$cols == 0) $data .= "<br />\n"; $i++; } return $data; } function radio($options, $name, $id = '', $value = '', $cols = 5, $class = '', $ext = '', $width = 100) { if(!$id) $id = $name; if(!is_array($options)) $options = form::_option($options); $i = 1; $data = ''; if($class) $class = " class=\"$class\""; foreach($options as $k=>$v) { $checked = $k == $value ? 'checked' : ''; $data .= "<span style=\"width:{$width}px\"><label><input type=\"radio\" name=\"{$name}\" id=\"{$id}\" value=\"{$k}\" style=\"border:0px\" $class {$ext} {$checked}/> {$v}</label></span> "; if($i%$cols == 0) $data .= "<br />\n"; $i++; } return $data; } function _option($options, $s1 = "\n", $s2 = '|') { $options = explode($s1, $options); foreach($options as $option) { if(strpos($option, $s2)) { list($name, $value) = explode($s2, trim($option)); } else { $name = $value = trim($option); } $os[$value] = $name; } return $os; } function image($name, $id = '', $value = '', $size = 50, $class = '', $ext = '', $modelid = 0, $fieldid = 0) { if(!$id) $id = $name; return "<input type=\"text\" name=\"$name\" id=\"$id\" value=\"$value\" size=\"$size\" class=\"$class\" $ext/> <input type=\"hidden\" name=\"{$id}_aid\" value=\"0\"> <input type=\"button\" name=\"{$name}_upimage\" id=\"{$id}_upimage\" value=\"上传图片\" style=\"width:60px\" onclick=\"javascript:openwinx('?mod=phpcms&file=upload_field&uploadtext={$id}&modelid={$modelid}&fieldid={$fieldid}','upload','350','350')\"/>"; } function file($name, $id = '', $size = 50, $class = '', $ext = '') { if(!$id) $id = $name; return "<input type=\"file\" name=\"$name\" id=\"$id\" size=\"$size\" class=\"$class\" $ext/> "; } function downfile($name, $id = '', $value = '', $size = 50, $mode, $class = '', $ext = '') { if(!$id) $id = $name; $mode = "&mode=".$mode; if(defined('IN_ADMIN')) { return "<input type=\"text\" name=\"$name\" id=\"$id\" value=\"$value\" size=\"$size\" class=\"$class\" $ext/> <input type=\"hidden\" name=\"{$id}_aid\" value=\"0\"> <input type=\"button\" name=\"{$name}_upfile\" id=\"{$id}_upfile\" value=\"上传文件\" style=\"width:60px\" onclick=\"javascript:openwinx('?mod=phpcms&file=upload&uploadtext={$id}{$mode}','upload','390','180')\"/>"; } else { return true; } } function upload_image($name, $id = '', $value = '', $size = 50, $class = '', $property = '') { if(!$id) $id = $name; return "<input type=\"text\" name=\"$name\" id=\"$id\" value=\"$value\" size=\"$size\" class=\"$class\" $property/> <input type=\"button\" name=\"{$name}_upimage\" id=\"{$id}_upimage\" value=\"上传图片\" style=\"width:60px\" onclick=\"javascript:openwinx('?mod=phpcms&file=upload&uploadtext={$id}','upload','380','350')\"/>"; } function select_template($module, $name, $id = '', $value = '', $property = '', $pre = '') { if(!$id) $id = $name; $templatedir = TPL_ROOT.TPL_NAME.'/'.$module.'/'; $files = array_map('basename', glob($templatedir.$pre.'*.html')); $names = cache_read('name.inc.php', $templatedir); $templates = array(''=>'请选择'); foreach($files as $file) { $key = substr($file, 0, -5); $templates[$key] = isset($names[$file]) ? $names[$file].'('.$file.')' : $file; } ksort($templates); return form::select($templates, $name, $id, $value, $property); } function select_file($name, $id = '', $value = '', $size = 30, $catid = 0, $isimage = 0) { if(!$id) $id = $name; return "<input type='text' name='$name' id='$id' value='$value' size='$size' /> <input type='button' value='浏览...' style='cursor:pointer;' onclick=\"file_select('$id', $catid, $isimage)\">"; } function select_module($name = 'module', $id ='', $alt = '', $value = '', $property = '') { global $MODULE; if($alt) $arrmodule = array('0'=>$alt); foreach($MODULE as $k=>$v) { $arrmodule[$k] = $v['name']; } if(!$id) $id = $name; return form::select($arrmodule, $name, $id, $value, 1, '', $property); } function select_model($name = 'modelid', $id ='', $alt = '', $modelid = '', $property = '') { global $MODEL; if($alt) $arrmodel = array('0'=>$alt); foreach($MODEL as $k=>$v) { if($v['modeltype'] > 0) continue; $arrmodel[$k] = $v['name']; } if(!$id) $id = $name; return form::select($arrmodel, $name, $id, $modelid, 1, '', $property); } function select_member_model($name = 'modelid', $id = '', $alt = '', $modelid = '', $property = '') { global $MODEL; if($alt) $arrmodel = array('0'=>$alt); foreach($MODEL as $k=>$v) { if($v['modeltype'] == '2') { $arrmodel[$k] = $v['name']; } } if(!$id) $id = $name; return form::select($arrmodel, $name, $id, $modelid, 1, '', $property); } function select_category($module = 'phpcms', $parentid = 0, $name = 'catid', $id ='', $alt = '', $catid = 0, $property = '', $type = 0, $optgroup = 0) { global $tree, $CATEGORY; if(!is_object($tree)) { require_once 'tree.class.php'; $tree = new tree; } if(!$id) $id = $name; if($optgroup) $optgroup_str = "<optgroup label='\$name'></optgroup>"; $data = "<select name='$name' id='$id' $property>\n<option value='0'>$alt</option>\n"; if(is_array($CATEGORY)) { $categorys = array(); foreach($CATEGORY as $id=>$cat) { if(($type == 2 && $cat['type'] ==2) || ($type == 1 && $cat['type'])) continue; if($cat['module'] == $module) $categorys[$id] = array('id'=>$id, 'parentid'=>$cat['parentid'], 'name'=>$cat['catname']); } $tree->tree($categorys); $data .= $tree->get_tree($parentid, "<option value='\$id' \$selected>\$spacer\$name</option>\n", $catid, '' , $optgroup_str); } $data .= '</select>'; return $data; } function select_pos($name = 'posid', $id ='', $posids = '', $cols = 1, $width = 100) { global $db,$priv_role, $POS; if(!$id) $id = $name; $pos = array(); foreach($POS as $posid=>$posname) { if($priv_role->check('posid', $posid)) $pos[$posid] = str_cut($posname, 16, ''); } return form::checkbox($pos, $name, $id, $posids, $cols, '', '', $width); } function select_group($name = 'groupid', $id ='', $groupids = '', $cols = 1, $width = 100) { global $db, $GROUP; if(!$id) $id = $name; return form::checkbox($GROUP, $name, $id, $groupids, $cols, '', '', $width); } function select_type($module = 'phpcms', $name = 'typeid', $id ='', $alt = '', $typeid = 0, $property = '', $modelid = 0) { $types = subtype($module, $modelid); if(!$id) $id = $name; $data = "<select name='$name' id='$id' $property>\n<option value='0'>$alt</option>\n"; foreach($types as $id=>$t) { $selected = $id == $typeid ? 'selected' : ''; $data .= "<option value='$id' $selected>$t[name]</option>\n"; } $data .= '</select>'; return $data; } function select_area($name = 'areaid', $id ='', $alt = '', $parentid = 0, $areaid = 0, $property = '') { global $tree, $AREA; if(!is_object($tree)) { require_once 'tree.class.php'; $tree = new tree; } if(!$id) $id = $name; $data = "<select name='$name' id='$id' $property>\n<option value='0'>$alt</option>\n"; if(is_array($AREA)) { $areas = array(); foreach($AREA as $id=>$a) { $areas[$id] = array('id'=>$id, 'parentid'=>$a['parentid'], 'name'=>$a['name']); } $tree->tree($areas); $data .= $tree->get_tree($parentid, "<option value='\$id' \$selected>\$spacer\$name</option>\n", $areaid); } $data .= '</select>'; return $data; } function select_urlrule($module = 'phpcms', $file = 'category', $ishtml = 1, $name = 'urlruleid', $id ='', $urlruleid = 0, $property = '') { global $db; $urlrules = array(); $result = $db->query("SELECT `urlruleid`,`example` FROM `".DB_PRE."urlrule` WHERE `module`='$module' AND `file`='$file' AND `ishtml`='$ishtml' ORDER BY `urlruleid`"); while($r = $db->fetch_array($result)) { $urlrules[$r['urlruleid']] = $r['example']; } $db->free_result($result); if(!$id) $id = $name; return form::select($urlrules, $name, $id, $urlruleid, 1, '', $property); } function select_linkage($keyid = 0, $parentid = 0, $name = 'catid', $id ='', $alt = '', $linkageid = 0, $property = '') { global $tree, $db; if(!is_object($tree)) { require_once 'tree.class.php'; $tree = new tree; } if(!$id) $id = $name; $sql = "SELECT * FROM `".DB_PRE."linkage` WHERE `keyid`='$keyid' ORDER BY `listorder` DESC,`linkageid`"; $result = $db->query($sql); while($r = $db->fetch_array($result)) { $infos[$r['linkageid']] = $r; } $data = "<select name='$name' id='$id' $property>\n<option value='0'>$alt</option>\n"; if(!empty($infos)) { $categorys = array(); foreach($infos as $id=>$cat) { $categorys[$id] = array('id'=>$id, 'parentid'=>$cat['parentid'], 'name'=>$cat['name']); } $tree->tree($categorys); $data .= $tree->get_tree($parentid, "<option value='\$id' \$selected>\$spacer\$name</option>\n", $linkageid); } $data .= '</select>'; return $data; } } ?>
生成的html里有你说的那一条代码,但源代码里没有。 |
回复 |
作者: 小浪子, 发布日期: 2013-02-28 17:20:12 |
回复qqeer:呵呵。你搞php的。居然不会整。。。那就没办法了。我反正不懂php.
|
回复 |
作者: qqeer, 发布日期: 2013-02-28 17:23:00 |
回复小浪子:我不是搞PHP的,纠结啊。
|
回复 |