ESql修改之插入MySQL資料庫記錄執行個體,esqlmysql

來源:互聯網
上載者:User

ESql修改之插入MySQL資料庫記錄執行個體,esqlmysql

一個資訊網站維護個人內容的執行個體,添加資訊

資訊編輯頁面

引入編輯器指令碼

<script type="text/javascript" src="@{sys:path}fckeditor/fckeditor.js"></script><BODY leftMargin=0 topMargin=0 MARGINWIDTH="0" MARGINHEIGHT="0" onload="showFCK()">
資訊標題及內容編輯器
<TABLE class=border cellSpacing=0 cellPadding=0 width="98%" align=center   border=0>          <form action="@{sys:face}@{sys:curPath}blog_add_save.chtml" method="post" id="save"><TR><TD align=center height=24 noWrap>  <b>標 題</b> </TD><td><input name="title" size=98></td></TR><TR>  <TD align=center height=24 valign="top" colspan=2><textarea name=content style="display:none"></textarea><script type="text/javascript">function showFCK(){var sBasePath = "@{sys:path}fckeditor/";var oFCKeditor = new FCKeditor( 'content' ) ;oFCKeditor.BasePath= sBasePath ;oFCKeditor.Height= 600 ;oFCKeditor.Value= '' ;oFCKeditor.ReplaceTextarea() ;}</script>  </TD></TR><input type="hidden" value="@{pPage:n}" name="n">  </form>    <tr><td height="30" colspan=2 align=center><a href="javascript:doSubmit();" id=MySubmit1>[提交]</a><div id=MyWait1 style="display:none">正在提交,請稍候...</div></td>    </tr></TABLE>
提交資訊的指令碼
function doSubmit(){var saves = document.forms['save'];if(saves['title'].value==""){alert("標題不能空!");saves['title'].focus();return;}var oEditor = FCKeditorAPI.GetInstance('content');var oDOM = oEditor.EditorDocument;var des;if(document.all)// If Internet Explorer.des = oEditor.EditorDocument.body.innerText;else{// If Gecko.var r = oDOM.createRange();r.selectNodeContents(oDOM.body);des = r.toString();}if(des==""){alert("內容不能空!");return;}saves.submit();MySubmit.style.display="none";MyWait.style.display="block";MySubmit1.style.display="none";MyWait1.style.display="block";}
顯示

資訊儲存的頁面

判斷登入

<if x="@{session:user_id}" else=1><script>alert("請先登入!");top.location.href="@{sys:path}";</script><we>...</we></if>
取ID

<bag id=doc><we name=we_id>@{sn:favorite}</we></bag><if x="@{doc:we_id}"><we><esql module=base id=pk commit=true>Select max(WE_ID) as favorite_id from favorite_base</esql><bag id=doc><we name=we_id>@{sn:favorite=@{pk:favorite_id}}</we></bag></we></if>
中文分詞

<!-- 分詞 --><call>doc2words</call>...<chtml file="htm/doc2words.htm" onlycall id=doc2words />
插入資訊
<ESql module=base act=edit commit=true>Insert Into favorite_base(we_id,title,words,content,words_content)Values(@{doc:we_id:int},@{pPage:title:string},@{pPage:words:string},@{pPage:content:memo},@{pPage:words_content:memo})</ESql><bag id=pPage><we name=content1>@{intLeft:@{pPage:content1}(580)}</we></bag><ESql module=base act=edit>Insert Into favorite_user(f_id,author,tree_id,ondate,memo)Values('@{doc:we_id}','@{session:user_id}','@{pPage:n}','@{sys:date}',@{pPage:content1:memo})</ESql>
返回列表頁
<to>@{sys:path}@{sys:curPath}blogs.html?n=@{pPage:n}&myid=@{session:user_id}</to>
完整的網頁代碼
<html><chtml><if x="@{session:user_id}" else=1><script>alert("請先登入!");top.location.href="@{sys:path}";</script><we><bag id=doc><we name=we_id>@{sn:favorite}</we></bag><if x="@{doc:we_id}"><we><esql module=base id=pk commit=true>Select max(WE_ID) as favorite_id from favorite_base</esql><bag id=doc><we name=we_id>@{sn:favorite=@{pk:favorite_id}}</we></bag></we></if><!-- 分詞 --><call>doc2words</call><ESql module=base act=edit commit=true>Insert Into favorite_base(we_id,title,words,content,words_content)Values(@{doc:we_id:int},@{pPage:title:string},@{pPage:words:string},@{pPage:content:memo},@{pPage:words_content:memo})</ESql><bag id=pPage><we name=content1>@{intLeft:@{pPage:content1}(580)}</we></bag><ESql module=base act=edit>Insert Into favorite_user(f_id,author,tree_id,ondate,memo)Values('@{doc:we_id}','@{session:user_id}','@{pPage:n}','@{sys:date}',@{pPage:content1:memo})</ESql><to>@{sys:path}@{sys:curPath}blogs.html?n=@{pPage:n}&myid=@{session:user_id}</to></we></if></chtml></html><chtml file="htm/doc2words.htm" onlycall id=doc2words />
儲存後的列表效果

這部分代碼在輕開B2C電子商務網站中的site\blog目錄下,趕快開啟試試吧!


輕開平台資源下載及說明

平台免費下載:http://download.csdn.net/detail/tx18/8381859

最新開發手冊下載:http://download.csdn.net/detail/tx18/8411089

開發執行個體:輕開B2C電子商務網站,免費下載:http://download.csdn.net/detail/tx18/8318585

輕開平台會不定期升級為大家提供更多強大而Easy的功能,請留意最新的開發手冊



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.