克隆一个新项目的快捷方式

yipeiwu_com5年前PHP代码库

有没想过最土的项目如何快速复制出一个来,然后改改就成新的团购项目了?

或者说编辑一个老项目的时候想把他另存为一个新项目而不是保存,

看下图 红色部分

zuituclone

具体开发代码(非细节),如下

修改模板,加入按钮

include/template/manage_team_edit.html

<input type=”submit” value=”保存为新项目” name=”commit” id=”leader-submit” class=”formbutton” style=”margin:10px 0 0 120px;” onclick=”cloneteam()”/>

加js 处理cloneteam函数

function cloneteam()
{
document.getElementById(‘-user-form').action=”/manage/team/edit.php?clone=1″;
document.getElementById(‘-user-form').submit();
}

注意 clone=1

另外修改模板加了几处隐藏的hidden 内容,目的是为了复制老项目中的image image1 image2 字段

<!–{if $team['image']}–><span class=”hint”><input type='hidden' name=”hidden_team_image” value=”{$team['image']}”></span><!–{/if}–>

<!–{if $team['image1']}–><span class=”hint”><input type='hidden' name=”hidden_team_image1″ value=”{$team['image1']}”></span><!–{/if}–>

<!–{if $team['image2']}–><span class=”hint”><input type='hidden' name=”hidden_team_image2″ value=”{$team['image2']}”></span><!–{/if}–>

修改 manage/team/edit.php

原来代码是这样的

zuit-clone-team1

现在代码是这样的

zuit-clone-team2

相关文章

IStream与TStream之间的相互转换

   procedure TForm1.Button1Click(Sender: TObject);    ...

php过滤输入操作之htmlentities与htmlspecialchars用法分析

本文实例讲述了php过滤输入操作htmlentities与htmlspecialchars用法。分享给大家供大家参考,具体如下: 过滤输入 (即来自所列数据源中的任何数据)是指,转义或删...

PHP GD库相关图像生成和处理函数小结

本文总结了PHP GD库相关图像生成和处理函数。分享给大家供大家参考,具体如下: 这几天在学习图像验证码部分,参考了许多例子,都是用GD库来生成和绘制图像的,所以打算把GD库封装成类来使...

解决FastCGI 进程超过了配置的活动超时时限的问题

解决FastCGI 进程超过了配置的活动超时时限的问题

近日,需要满足测试需求,进行大数据并发测试时,报出【HTTP 错误 500.0 - Internal Server Error E:\PHP\php-cgi.exe - FastCGI...

php批量删除数据库下指定前缀的表以prefix_为例

如何用php批量删除数据库下所有前缀为prefix_的表。 例子,统一删除前缀为“prefix_”的表。 <?php //设置数据库连接信息。数据库服务器地址,数据...