前言
当我们在使用PHPCMS V9表单向导建立一个表单后,用户提交完内容后默认是返回首页的,八年前写过教程改成返回上一页: PHPCMS V9表单向导前台提交后跳转的修改
前段时间有用户提起这个事,要跳转到指定的页面如何做的时候,所以开发了这个修改方法,修改方法如下:
第一步
修改:/phpcms/modules/formguide/templates/formguide_edit.tpl.php
找到42左右的:
<tr>
<th><strong><?php echo L('allows_more_ip')?>:</strong></th>
在他上面增加:
<tr>
<th><strong>是否跳转:</strong></th>
<td><input name="setting[is_jump]" type="radio" value="1" <?php if ($data['setting']['is_jump']) {?>checked<?php }?>> <?php echo L('yes')?> <input name="setting[is_jump]" type="radio" value="0" <?php if ($data['setting']['is_jump']==0) {?>checked<?php }?>> <?php echo L('no')?></td>
</tr>
<tr id="is_jump_ok" style="<?php if ($data['setting']['is_jump']==0) {?>display:none;<?php }?>">
<th><strong>跳转地址:</strong></th>
<td><input type="text" name="setting[is_jump_add]" id="is_jump_add" class="input-text" value="<?php echo $data['setting']['is_jump_add']?>" size="50"></td>
</tr>
然后最下面的</script>上面增加:
$("input:radio[name='setting[is_jump]']").click(function (){
if($("input:radio[name='setting[is_jump]'][checked]").val()==0) {
$("#is_jump_ok").hide();
} else if($("input:radio[name='setting[is_jump]'][checked]").val()==1) {
$("#is_jump_ok").show();
}
});
第二步:
修改:/phpcms/modules/formguide/templates/formguide_add.tpl.php
找到42左右的:
<tr>
<th><strong><?php echo L('allows_more_ip')?>:</strong></th>
在他上面增加:
<tr>
<th><strong>是否跳转:</strong></th>
<td><input name="setting[is_jump]" type="radio" value="1" > <?php echo L('yes')?> <input name="setting[is_jump]" type="radio" value="0" checked> <?php echo L('no')?></td>
</tr>
<tr id="is_jump_ok" style="display:none;">
<th><strong>跳转地址:</strong></th>
<td><input type="text" name="setting[is_jump_add]" id="is_jump_add" class="input-text" size="50"></td>
</tr>
然后最下面的</script>上面增加:
$("input:radio[name='setting[is_jump]']").click(function (){
if($("input:radio[name='setting[is_jump]'][checked]").val()==0) {
$("#is_jump_ok").hide();
} else if($("input:radio[name='setting[is_jump]'][checked]").val()==1) {
$("#is_jump_ok").show();
}
});
第三步:
修改:/phpcms/modules/formguide/index.php
117行左右找到:
showmessage(L('thanks'), APP_PATH);
改成:
if ($setting['is_jump']=='1') {
showmessage(L('提交成功,为您跳转下载页面'), $setting['is_jump_add']);
} else {
showmessage(L('thanks'), HTTP_REFERER);
}
至此,修改结束,添加和编辑表单的时候会有跳转链接的选项,效果图如下:

否 为返回上一页,不影响其他表单
是 为跳转,输入跳转链接即可
周涛博客








评论前必须登录!
注册