ASP application template adopted

zhaozj2021-02-16  82

Beginner ASP, the program can be barely written, but if every website page is revised, all source transplants will be performed. If you consume a lot of human energy, even if you don't pay attention, you will abandon it.

So, dreaming that the program code of the large section becomes a few simple characters, so as long as the design of the page is inserted into it. In fact, this is also simple, just make the program code that implements this function into a child, and then the home page can be called.

Many times, in the blog China, you will choose a lot of templates, and you can also be designed yourself; or use pig flying blogs to change their site is not close to the same ... These are all attributed to The ASP features a template.

Then I will give a Buddha to give the template to give a group of friends.

First, the template needs to be modified online, then the database saves template code should be used.

The so-called template is the standard HTML code for design and completed.

The functional part implemented by the program will adopt

Special string instead. However, these special strings need to be compiled as a corresponding function when displayed.

1. Design Database Testmb.mdb

New Table Moban: Field M_ID (Auto Number, Lord Keyword); Field M_HTML (Remark Type)

2, assume the first template content code

Copy the following code to the m_html field

testmb </ title> </ head> <body leftmargin = "0" TopMargin = "0"> <table width = "100%" height = "100%" border = "0" cellpadding = "5" cellspacing = "2"> <tr align = "right" bgcolor = "# cccccc"> <TD Height = "20" colspan = "2"> $ cntop $ </ td> </ tr> <tr v = "top"> <td width = "25%" bgcolor = "# e5e5e5> $ CNLEFT $ </ TD> <td width = "74%" BGColor = "# f3f3f3"> $ CNRIGHT $ </ TD> </ TR> </ table> </ body> </ html></p> <p>Note $ CNTOP $, $ CNLEFT $, $ CNRIGHT $, which will implement some specific programs</p> <p>3, establish a database connection file Conn.asp</p> <p><% set conn = server.createObject ("adoDb.connection") connStr = "provider = microsoft.jet.Oledb.4.0; data source =" & Server.mappath ("testmb.mdb") Conn.open connStr%> 4, Establish a special string conversion required to lib.asp</p> <p>The main role of this document is to make the ASP program that implements some functions to make a word program to facilitate calls.</p> <p><% Dim topcodesub cntop () topcode = "current time is:" topcode = topcode & now () end subdim leftcode, isub cnleft () for i = 1 to 5 leftcode = leftcode & "<p> cnbruce.com" nextend subdim rightcodesub cnright ( ) For i = 1 to 9 rightcode = rightcode & "<hr color =" & I & I & I & I & I & I & I & I & I & I & I)> "NEXTEND SUB%></p> <p>5. Finally, call the template code in the database to convert special strings.</p> <p><! - # include file = "conn.asp" -> <! - # include file = "lib.asp" -> <% sql = "select * from moban where m_id = 1" set = server .CreateObject ("AdoDb.Recordset") RS.Open SQL, CONN, 1, 1MB_CODE = RS ("m_html") rs.closset = NothingcNTop () MB_CODE = Replace (MB_CODE, "$ CNTOP $", TOPCODE) CNLT ( ) MB_CODE = Replace (MB_CODE, "$ CNLT $", Leftcode) cnright () MB_CODE = Replace (MB_CODE, $ CNRight $ ", Rightcode) Response.write MB_CODE%></p> <p>This page main function is to display the template code and convert the special code in which the special code is functional.</p> <p>At this point, the template function of the ASP is basically completed, and the rest is: establish a program page with editing template function, change the library file to its own program function ...</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-12486.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="12486" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.040</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'a6v4LPJLBR4uIYV6x_2BjLp74nWpTKwugv_2B4HwAE_2BlOvYG96NFf7B3A4WTYvJ6weiYZKPfR2kWOsglZgml1IGmyw_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>