克隆一個(gè)新項(xiàng)目的快捷方式
有沒想過最土的項(xiàng)目如何快速復(fù)制出一個(gè)來,然后改改就成新的團(tuán)購項(xiàng)目了?
或者說編輯一個(gè)老項(xiàng)目的時(shí)候想把他另存為一個(gè)新項(xiàng)目而不是保存,
看下圖 紅色部分
具體開發(fā)代碼(非細(xì)節(jié)),如下
修改模板,加入按鈕
include/template/manage_team_edit.html
<input type=”submit” value=”保存為新項(xiàng)目” name=”commit” id=”leader-submit” class=”formbutton” style=”margin:10px 0 0 120px;” onclick=”cloneteam()”/>
加js 處理cloneteam函數(shù)
function cloneteam()
{
document.getElementById(‘-user-form').action=”/manage/team/edit.php?clone=1″;
document.getElementById(‘-user-form').submit();
}
注意 clone=1
另外修改模板加了幾處隱藏的hidden 內(nèi)容,目的是為了復(fù)制老項(xiàng)目中的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
原來代碼是這樣的
現(xiàn)在代碼是這樣的
相關(guān)文章
關(guān)于查看MSSQL 數(shù)據(jù)庫 用戶每個(gè)表 占用的空間大小
本篇文章是對查看MSSQL數(shù)據(jù)庫用戶每個(gè)表占用的空間大小進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06php中preg_replace正則替換用法分析【一次替換多個(gè)值】
這篇文章主要介紹了php中preg_replace正則替換用法,結(jié)合實(shí)例形式對比分析了preg_replace一次替換多個(gè)值的具體使用技巧,需要的朋友可以參考下2017-01-01Linux fgetcsv取得的數(shù)組元素為空字符串的解決方法
使用CSV導(dǎo)入數(shù)據(jù)的時(shí)候,我們通常用的是Windows系統(tǒng),使用GBK在Windows的Excel中編輯2011-11-11