ѡ̳

标题: 修改计划:栏目类型可切换 --已完成 [打印本页]

作者: admin    时间: 2017-11-17 09:53
标题: 修改计划:栏目类型可切换 --已完成
需要实现栏目类型添加后可自行切换,分别是单页 列表  外链
作者: admin    时间: 2017-11-18 04:15
标题: 已处理
已修改category_edit.tpl.php
增加 类型选择
  1. <tr>
  2.                 <th><?php echo L('type');?>:</th>
  3.                 <td>
  4.                         <label for="category_list" > <input id="category_list"   onclick="selecttype(this.value)" type='radio' name='info[type]' value='0'
  5.                                         <?php if($type==0) echo 'checked';?> > 列表 &nbsp;&nbsp;&nbsp;&nbsp; </label>
  6.                         <label for="category_page" > <input id="category_page"  onclick="selecttype(this.value)"   type='radio' name='info[type]' value='1'
  7.                                         <?php if($type==1) echo 'checked';?> > 单页 &nbsp;&nbsp;&nbsp;&nbsp; </label>
  8.                         <label for="category_link" >  <input id="category_link"  onclick="selecttype(this.value)"  type='radio' name='info[type]' value='2'
  9.                                         <?php if($type==2) echo 'checked';?> > 外链 </label>


  10.                 </td>
  11.         </tr>
复制代码
外链显示
  1. <tr  id="link_url" >
  2.                 <th><?php echo L('link_url')?>:</th>
  3.                 <td><input type="text" name="info[url]" id="url" size="50" class="input-text" value="<?php echo $url;?>"></td>
  4.         </tr>
复制代码
增加切换函数
  1.   function selecttype(type){
  2.                         switch(type){

  3.                                 case "0": $("#link_url").hide(); break;
  4.                                 case "1": $("#link_url").hide(); break;
  5.                                 case "2": $("#link_url").show(); break;
  6.                                 default:$("#link_url").hide(); break;
  7.                         }

  8.                         }

  9. selecttype('<?php echo $type;?>');
复制代码
取消验证部分 链接规则和选择模型判断
  1. $(function(){
  2.                 $.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
  3.                 //$("#modelid").formValidator({onshow:"<?php echo L('select_model');?>",onfocus:"<?php echo L('select_model');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('select_model');?>"}).defaultPassed();
  4.                 $("#catname").formValidator({onshow:"<?php echo L('input_catname');?>",onfocus:"<?php echo L('input_catname');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_catname');?>"}).defaultPassed();
  5.                 $("#catdir").formValidator({onshow:"<?php echo L('input_dirname');?>",onfocus:"<?php echo L('input_dirname');?>"}).regexValidator({regexp:"^([a-zA-Z0-9、-]|[_]){0,30}$",onerror:"<?php echo L('enter_the_correct_catname');?>"}).inputValidator({min:1,onerror:"<?php echo L('input_dirname');?>"}).ajaxValidator({type : "get",url : "",data :"m=admin&c=category&a=public_check_catdir&old_dir=<?php echo $catdir;?>",datatype : "html",cached:false,getdata:{parentid:'parentid'},async:'false',success : function(data){        if( data == "1" ){return true;}else{return false;}},buttons: $("#dosubmit"),onerror : "<?php echo L('catname_have_exists');?>",onwait : "<?php echo L('connecting');?>"}).defaultPassed();
  6.         //        $("#url").formValidator({onshow:" ",onfocus:"<?php echo L('domain_name_format');?>",tipcss:{width:'300px'},empty:true}).inputValidator({onerror:"<?php echo L('domain_name_format');?>"}).regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('domain_end_string');?>"});
  7.                 $("#template_list").formValidator({onshow:"<?php echo L('template_setting');?>",onfocus:"<?php echo L('template_setting');?>",oncorrect:"<?php echo L('input_right');?>"}).inputValidator({min:1,onerror:"<?php echo L('template_setting');?>"}).defaultPassed();
  8.         })
复制代码








欢迎光临 ѡ̳ (http://www.sunminxuan.cn/bbs/) Powered by Discuz! X3.4