生成公司資訊的靜態頁

2021-04-08 19:12:57 字數 3114 閱讀 4068

if(!directory.exists(companybasepath))

//讀取本地商業機會模板的檔案

string companyfilepath=basepath + "//filetemplet//company.htm";

string companycode=getfilecode(companyfilepath);

//查詢條件(輸入引數)

string strwhere=" where companyid=" + companyid;

sqldatareader myreadcompany=getdata.getdatareaderbysprocs("getcompany",strwhere);

if(myreadcompany.read())

//二級類別

companybasepath=companybasepath+"//" + myreadcompany["subsortid"].tostring();

if(!directory.exists(companybasepath))

//**類別

companybasepath=companybasepath+"//" + myreadcompany["endsortid"].tostring();

if(!directory.exists(companybasepath))

//獲取公司資訊

//替換行業類別

companycode=companycode.replace("thesortname",getdata.getfieldvalue("select sortname from sort where sortid=" + myreadcompany["sortid"].tostring()));//替換大類

companycode=companycode.replace("thesubsortname",getdata.getfieldvalue("select sortname from sort where sortid=" + myreadcompany["subsortid"].tostring()));//替換二類

companycode=companycode.replace("theendsortname",getdata.getfieldvalue("select sortname from sort where sortid=" + myreadcompany["endsortid"].tostring()));//替換三類

companycode=companycode.replace("thecompanyname",myreadcompany["companyname"].tostring());//替換公司名稱

companycode=companycode.replace("themainproduct",myreadcompany["mainproduct"].tostring());//替換主營產品

companycode=companycode.replace("thecompanytype",myreadcompany["companytype"].tostring());//替換企業型別

companycode=companycode.replace("thecompanymode",myreadcompany["companymode"].tostring());//替換企業經營模式

companycode=companycode.replace("theaddress",myreadcompany["address"].tostring());//替換位址

companycode=companycode.replace("thepostcode",myreadcompany["postcode"].tostring());//替換郵編

companycode=companycode.replace("theurl",myreadcompany["url"].tostring());//替換**

companycode=companycode.replace("thephone",myreadcompany["phone"].tostring());//替換**

companycode=companycode.replace("thelinkman",myreadcompany["personname"].tostring());//替換聯絡人

companycode=companycode.replace("thecompanyid",companyid);//替換資訊id

//取國家資訊

//設定國家位址

string country;

if(myreadcompany["country"].tostring()=="1")

else if(myreadcompany["country"].tostring()=="-1")

else

companycode=companycode.replace("thecountry",country);//替換國家

}myreadcompany.close();

//寫入檔案

filename = basepath + "//htmlfile//" + filename;

createfilebypath(filename,companycode);

}///

/// 讀取本地網頁的**

///

///

///

public static string getfilecode(string filepath)

sr.close();

return revalue;

}///

/// 通過路徑儲存檔案

///

///

///

public static void createfilebypath(string filepath,string filecode)

filestream fs = new filestream(filepath, filemode.createnew);

streamwriter w = new streamwriter(fs,encoding.getencoding("gb2312"));

w.write( filecode);

w.close();

fs.close();

}

生成靜態頁

先定義乙個staticfilecachemodule 實現ihttpmodule介面 定製beginrequest事件 再定義乙個類 要生成靜態頁面的繼承它就行了 將頁面內容輸出到瀏覽器 response.write pagecontent 當然不要忘在配置web.confing 用模板生成靜態頁 ...

php生成靜態頁

先建立一chtml資料庫 表名稱為bihtml create table bihtml id int 11 auto increment not null,szdtitle varchar 30 szdcontent text primary key id 在表中插入兩條記錄 insert into...

PHP生成靜態頁

最近作的乙個專案中用到了兩種用 php 生成靜態頁面的 方法 回想起當初自己還不知道如何生成靜態頁面的迷惘,以及看不懂高手寫的文章的痛苦,覺得自己有必要站出來為還不知道如何生成靜態頁的phper寫乙個通俗點文章,以幫助他們盡快掌握這個好東西。在我之前所見的文章中要不是用 堆砌空間就是用高手與高手交流...