仓酷云
标题:
ASP网页编程之创建一个相似YAHOO的导航条
[打印本页]
作者:
只想知道
时间:
2015-1-16 23:22
标题:
ASP网页编程之创建一个相似YAHOO的导航条
当然了,现在国内CRM厂商的产品与其说是CRM,但从至少从我的角度分析上来看,充其量只是一个大型的进销存而已了,了解尚浅,不够胆详评,这里只提技术问题yahooThissamplewilldemonstratehowtoquicklybuildasimpleYahoo!stylenavigationbarthatdisplaysthepathsauserhastakentogettoagivendirectory,andalsodisplaysatableoflinkstothesub-directoriesofthecurrentdirectory.
ThefirstthingIliketodowhenbeginninganydatabasedrivenapplicationistodesignthedatastructure.Ofcourse,oncewegetintowritingthecode,manytimescolumnsortablesneedtobeaddedormodifiedfromtheinitialdesign,buthavingadataframeworkhelpstogiveussomefocusanddirection.
DatabaseLayout
IamusinganAccess2000databaseforthisexample.YoucandefinitelyportthistoanyRDBMSeasily;justfollowthesametablearchitecture.
LetsstartbycreatinganewAccessdatabase,andnameitBread.mdb.
CreateasingletableandnameittblParents.
OpenitupinDesignModeandaddthefollowingcolumns.
*Youcanskipbuildingallthisfromscratchbydownloadingthesourcefiles.
Bread.mdb
ColumnNameDataType
AIDAutoNumber(PrimaryKey)
DirNameText
ChildDirText
ParentDirText
ChildDirDescriptMemo
DirDescriptMemo
*IfdesigningforSQLServer,maketheAIDColumnanIdentityField,withanincrementof1andmakesureallownullsisoff.
Nextwewillwanttopopulateourtablewithdata,soletmeexplainthelogicofthearchitecture.
Startbyinsertingthedatafortherootdirectoryofyourwebserver.Thiswillbespecifiedbyinsertingaforwardslash/intotheDirNamecolumn.
NextaddthedirectorybelowtheroottotheChildDircolumn(makesureyouaddtheexactdirectorynameasitappearsontheserver)
Sincethisistherootdirectory,leavetheParentDircolumnblank.
FortheChildDirDescriptColumn,youwanttoenterwhateveryouwantthetexttoreadforthelinktotheChildDirdirectorythatyoujustentered.(i.e.,ifyouenteredmusicasaChildDirName,youmaywantthelinkthatpointstomusictoalsoreadMusic,soyouenterMusicintheChildDirDescriptcolumnforthisentry.IfyouwantittoreadModernMusic,enterthat)
FortheDirDescriptcolumn,enterthetextyouwanttoappeartodescribethecurrentdirectory,whichinthiscaseistherootfolder.IusedthewordHomeasthedescriptionsothatuserswillalwaysknowthatclickingonthislinkwillbringmebacktothebeginning.
Repeatthisprocessforeachsubdirectoryyouhavebelowyourwebroot.
Note:Makesuretocreatetheactualdirectorystructureonthewebserverifitdoesnotalreadyexist.
Yourdatashouldlooksimilartothis:
Afteryoucompletethisprocessmakesureyoualsomakeentriesinthedatabaseforthedirectoriesyoujustadded.InmycaseIaddedadirectoryMusic,sonowImustaddtheappropriateFieldsforMusic.SinceMusichasaparentdirectory(Root),wemustspecifyitbyaddingaforwardslashforParentDir.
PopulatethedataforMusicandanyotherSubDirectoriesyoulike.
Youmayrefertothescreenshotbelowformyexample.
*TheChildDircolumnsshouldcontainallthedirectoriesbelowtheRoot.
TheCode
Nowthatwehavesomevaliddata,letsstartbycreatingacoupleoffunctions.Wewillhousethesefunctionsinanincludefile,namedfolderFunctions.asp.Thefirstfunctionwewantisafunctiontoreturnthecurrentphysicaldirectoryofthewebserver.Wewillusethisfunctionwhenwedoadatabaselookuptobuildtheappropriatelinksandpathhistory.InamedthisfunctionGetThisPath.
Firstthingourfunctionneedstodoisgetthecurrentfullpathfromtheserver.WewillusethePath_InfomethodoftheServerVariablescollectiontolookitup.
Sinceweonlywantthecurrentdirectoryname,wewillsplitthestringreturnedfromPath_Infoattheforwardslash,whichwillcreateanarraycontainingallthedirectoriesabovethecurrentdirectory.Thenwewillneedtoloopthrutheentirearraytopullonlythedataweneed(thecurrentdirectory).Wewillaccomplishthisbysettingourlooptoexitatthenexttothelastentryinthearray(Theverylastentrywouldbethepagenameandwedontwantthat).Thewaywedothisistotellthelooptoexecuteasmanytimesasvaluesthearrayholdsminusone.WegetthatinformationbyaskingthearrayforitsupperBounds.
Thenwewillsetthefunctionsreturnvaluetothelastentryinourloopbyoverwritingthereturnvalueineachloop,whichwillbethecurrentdirectory.However,ifthearrayisempty,itmeansweareattherootoftheserverandweneedtosetthereturnvalue</p>ASP脚本是采用明文(plaintext)方式来编写的。
作者:
admin
时间:
2015-1-20 09:43
下面简单介绍一下我学习ASP的方法,希望对想学习ASP的朋友有所帮助...
作者:
精灵巫婆
时间:
2015-1-26 13:15
我认为比较好的方法是找一些比较经典的例子,每个例子比较集中一种编程思想而设计的。
作者:
灵魂腐蚀
时间:
2015-2-2 11:11
Session:这个存储跟客户端会话过程的数据,默认20分钟失效
作者:
再现理想
时间:
2015-2-3 14:08
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
作者:
蒙在股里
时间:
2015-2-9 02:55
交流是必要的,不管是生活还是学习我们都要试着去交流,通过交流我们可以学到很多我们自己本身所没有的知识,可以分享别人的经验甚至经历。
作者:
若相依
时间:
2015-2-26 19:32
没有坚实的理论做基础,那么我们连踏入社会第一步的资本都没有,特别对于计算机专业的学生学好专业知识是置关重要的。在这里我侧重讲一下如何学习ASP,从平时的学习过程中。
作者:
深爱那片海
时间:
2015-3-8 16:47
我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。
作者:
只想知道
时间:
2015-3-16 06:24
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
作者:
小魔女
时间:
2015-3-22 20:52
ASP的语言不仅仅只是命令格式差不多,而是包含在<%%>之内的命令完全就是VB语法。虽然ASP也是做为单独的一个技术来提出的,但他就是完全继承了VB所有的功能。
欢迎光临 仓酷云 (http://ckuyun.com/)
Powered by Discuz! X3.2