自留地
切勿乱来!
     找回密码

PHPCMS V9 表单向导增加自定义跳转链接修改教程

#PHPCMS专题

前言

当我们在使用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 }?>>&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="setting[is_jump]" type="radio" value="0" <?php if ($data['setting']['is_jump']==0) {?>checked<?php }?>>&nbsp;<?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" >&nbsp;<?php echo L('yes')?>&nbsp;&nbsp;<input name="setting[is_jump]" type="radio" value="0" checked>&nbsp;<?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);
			}

至此,修改结束,添加和编辑表单的时候会有跳转链接的选项,效果图如下:

否 为返回上一页,不影响其他表单

是 为跳转,输入跳转链接即可

 

3 收藏 打赏
×
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《PHPCMS V9 表单向导增加自定义跳转链接修改教程》
文章链接:https://www.ediok.cn/blog/2021/11/5317.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
分享到

评论 抢沙发

评论前必须登录!

 

关注互联网发展前沿,关注PHPCMS技术演进,钻研PHPCMS技术开发

问答社区 联系我们

登录

登录即表示同意本站用户协议隐私政策
©2026 周涛博客 All rights reserved

注册

注册即表示同意本站用户协议隐私政策
©2026 周涛博客 All rights reserved

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

微信扫一扫

微信扫一扫