inc文件介绍
.inc文件相關知識介紹
1. .inc 文件顧名思義是include file的意思。 實際上,文件的后綴對于文件包含是無所謂 你可以包含一個asp文件,也可以包含txt文。 一般我們使用inc作為后綴,是因為這樣能體現該文件的作用。
2...inc文件的作用有點類似于C/C++內的.H .HPP頭文件,使用inc文件可以使我們的程序,增加可讀性,更易于開發和維護。
3.使用SSI(Server Side Include)指令中的#Include來使用他 asp包含文件的寫法是這樣的:?
在html中,寫:?
<!-- #include file = "FileName" -->?
<!-- #include Virtual = "FileName" -->?
file和virtual的區別在于file使用相對路徑?
而Virtual是你的web站點內虛擬目錄的完整虛擬路徑?
比方:?
<!-- #include file = "inc/Test.inc" -->?
就表示包含當前文件所在的虛擬目錄路徑下面的inc目錄下的char.inc?
寫成 virtual就可能就需要這么寫了?
<!-- #include virtual = "/myweb/inc/Test.inc" -->
?
?
當一段html內容,需要在多個頁面重復使用的時候,可以把這部分集成到一起,到其他頁面多次引用就可以了
? <div class="g-tab pr">
? ? ? ? <!--#include virtual="/dlist/inc/navi.inc"-->
? ? ? ? <!--#include virtual="/dlist/inc/lib.inc"-->
? ? ? ?<ul>
? ? ? ? ? <li>列表內容1</li>
? ? ? ? ? <li>列表內容2</li>
? ? ? ? ? <li>列表內容3</li>
? ? ? ?</ul>
? ? </div>
通過include引入文件
navi.inc文件里面的內容是一段html代碼 ,如下:
<div class="rotatebox-sbox"><div class="tit-box"><h2>被插入的內容</h2></div><div class="rotatebox-s" id="rotate-s"> <div class="hd"><ul><li><a href="###">1</a></li><li><a href="###">2</a></li><li><a href="###">3</a></li><li><a href="###">4</a></li></ul></div><div class="bd" id="good_rec_info"></div></div> </div>?navi.inc文件里面可以支持寫css,html,script引入js文件等?,如下:
<div class="rotatebox-sbox"><div class="tit-box"><h2>被插入的內容</h2></div><div class="bd" id="good_rec_info"></div></div> </div><script src="js/a.js"></script> <script src="js/b.js"></script>?
?
include一個底部版權的文案的html
1.index.html中的include的寫法部分(直接寫在body中,不能寫在script標簽中)<!-- footer S --> <!--#include virtual="XXX/footer.html"--> <!-- footer E -->2.footer.html中的寫法(內部可包含css,html,js的代碼)<style>#footWrap a { color: #9f9378; }#footWrap a:hover { text-decoration: underline; }</style><div class="foot-wrap" id="footWrap"><p class="copyright_txt">COPYRIGHT © ALL RIGHTS RESERVED.</p></div><script src="XXX/foot.js"></script>?
總結
- 上一篇: java 字符串随机排列_Java 随
- 下一篇: 宏晶STC单片机使用STC-ISP串口烧