仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 477|回复: 9
打印 上一主题 下一主题

[学习教程] ASP网页编程之创建一个相似YAHOO的导航条

[复制链接]
只想知道 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 23:22:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
当然了,现在国内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:23 | 只看该作者
下面简单介绍一下我学习ASP的方法,希望对想学习ASP的朋友有所帮助...
精灵巫婆 该用户已被删除
板凳
发表于 2015-1-26 13:15:53 | 只看该作者
我认为比较好的方法是找一些比较经典的例子,每个例子比较集中一种编程思想而设计的。
灵魂腐蚀 该用户已被删除
地板
发表于 2015-2-2 11:11:31 | 只看该作者
Session:这个存储跟客户端会话过程的数据,默认20分钟失效
再现理想 该用户已被删除
5#
发表于 2015-2-3 14:08:58 | 只看该作者
如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
蒙在股里 该用户已被删除
6#
发表于 2015-2-9 02:55:05 | 只看该作者
交流是必要的,不管是生活还是学习我们都要试着去交流,通过交流我们可以学到很多我们自己本身所没有的知识,可以分享别人的经验甚至经历。
若相依 该用户已被删除
7#
发表于 2015-2-26 19:32:01 | 只看该作者
没有坚实的理论做基础,那么我们连踏入社会第一步的资本都没有,特别对于计算机专业的学生学好专业知识是置关重要的。在这里我侧重讲一下如何学习ASP,从平时的学习过程中。
深爱那片海 该用户已被删除
8#
发表于 2015-3-8 16:47:13 | 只看该作者
我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。
只想知道 该用户已被删除
9#
 楼主| 发表于 2015-3-16 06:24:54 | 只看该作者
如何更好的使自己的东西看上去很不错等等。其实这些都不是问题的实质,我们可以在实践中不断提升自己,不断充实自己。
小魔女 该用户已被删除
10#
发表于 2015-3-22 20:52:27 | 只看该作者
ASP的语言不仅仅只是命令格式差不多,而是包含在<%%>之内的命令完全就是VB语法。虽然ASP也是做为单独的一个技术来提出的,但他就是完全继承了VB所有的功能。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-6-4 14:42

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表