引入檔案,js引入js檔案

來源:互聯網
上載者:User

引入檔案,js引入js檔案

chtml/ChinaHtml標籤另外一個重要的用途是引入檔案,類似於jsp中的<% @ include file=”file-url” %>,asp中的<!--#include file="wisdom.inc"-->,及php中的<?php include 'menu.php';?>

  用法:<chtml file=檔案名稱></chtml>,檔案名稱是指在WebEasy系統目錄(D:/webeasy/)下含相對路徑的檔案名稱

  範例:

<pre name="code" class="html"><html><p><chtml file=_samples/public.html /></p><p><ChinaHtml file=_samples/order.html /></p></html>
效果:


(例子檔案:_samples/import.html)

再看一在實際開發中的應用:

輕開B2C電子商務網站(免費下載:http://download.csdn.net/detail/tx18/8318585)的首頁index.html檔案

<HTML><HEAD><chtml><bag id=pPage><we name=title></we><we name=Description></we></bag></chtml><chtml file="htm/head_@{head:client}.htm" /><!-- 判斷能不能修改 --><chtml><Bag id=sys><we name=NodeID>c0.0</we></Bag></chtml><!-- 欄目節點 --><chtml file="base/ac/checkAcl.htm"/><!-- 引入許可權檢查檔案 --></HEAD><BODY leftMargin=0 topMargin=0 MARGINWIDTH="0" MARGINHEIGHT="0"><chtml file="htm/top.htm"/><TABLE cellSpacing=0 cellPadding=0 width="974" align=center border=0>    <TR><TD><chtml file="htm/index_c.htm" /><chtml file="htm/index_c1.htm" />    </TD>  </TR></TABLE><script Language="JavaScript">//記錄點擊次數function visit_show(id){if(xmlHttpReq==null)xmlHttpReq = AB.getXmlHttp();xmlHttpReq.open("GET","@{sys:path}site/eb/sale_visit.xml?we_id="+id,true);xmlHttpReq.setRequestHeader("cache-control","no-cache");xmlHttpReq.send(null);}</script><chtml file="htm/foot.htm"/></BODY></HTML>
從上到下共引入了5個檔案,以中間的htm/index_c.htm為例:
<TABLE cellSpacing=0 cellPadding=0 border=0 width="100%">  <TR><TD width="730" rowspan=8 valign=top><chtml file="htm/img_play.htm" /></TD><TD width=6 rowspan=8><img src="@{sys:path}images/space.gif" width=6></TD><TD width="236" class=tablehead width="100%" height=25>   <A class=tab_head href="@{sys:path}site/list.html?m=2&s=4">行業動態</A></TD>  </TR>        <TR>          <TD width="100%" height=222 vAlign=top class=border1><chtml><esql module="base" id="list">Select we_id,title from base_info order by we_id desc limit 5</esql><for bags=list end="@{list:getLength}"><div style="padding-top:6px;padding-left:5px;height:18px"><img src="@{sys:path}images/dot1.gif" border=0> <a href="@{sys:path}site/show.html?myid=@{list:we_id}" title="@{list:title}" target=_blank>@{intLeft:@{list:title}(17)}</a></div></for></chtml>  </TD></TR><tr><td height=6></td></tr><TR><TD class=tablehead width="100%" height=25>   <A class=tab_head href="#">今日特價</A></TD></TR>        <TR>          <TD width="100%" height=204 vAlign=top class=border1><chtml><esql module="base" id="list">Select NAME,IMG_URL,LINK from images_base where catalog=2 order by WE_ID desc limit 1</esql><if x="@{list:getLength}" else=1><we x=0 /><div align=center style="padding-top:6px;"><A href="@{list:LINK}" target=_blank title="@{list:NAME}"><img src="@{list:img_url}" width=230 height=192 border=0></A></div></if></chtml>  </TD></TR></TABLE>
index_c.htm中又引入了htm/img_play.htm,從名稱上看是用來播放圖片,下邊先後進行了行業動態和今日特價的查詢和顯示

效果:


更多效果請發布輕開B2C電子商務網站


輕開平台資源下載及說明

平台免費下載: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.