Today, website templates are prevalent. Many websites use the template technology. The most common example is PHP. Now many PHP uses templates, so we are considering the trend. Today we also bring ASP. NET template calling problems. I have also written examples about ASP templates before. In fact, the methods are similar, but the forms are different.
Next I will explain the specific methods for you. Main Methods:
The Code is as follows: |
Copy code |
Public string GetInterIDList (string strfile) { String strout; Strout = ""; If (! File. Exists (System. Web. HttpContext. Current. Server. MapPath (strfile ))) { } Else { StreamReader sr = new StreamReader (System. Web. HttpContext. Current. Server. MapPath (strfile), System. Text. Encoding. Default ); String input = sr. ReadToEnd (); Sr. Close (); Strout = input; } Return strout; } |
The above method is mainly used to read the template and then load it.
The method called below is used directly:
GetInterIDList ("Template/index.html"); // This method is mainly used to drop the Template, which is mainly the Template path.
In future programs, templates will inevitably increase, because templates have many advantages.