230 likes | 357 Views
INFO 330. Reverse Engineering Activity Introduction and Instructions. Steps. Dissect the site Name the areas Analyze the content Model the info types from the content Implement the info types in an RDB Model and implement the Navigation Turn pages into templates.
E N D
INFO 330 Reverse Engineering Activity Introduction and Instructions
Steps • Dissect the site • Name the areas • Analyze the content • Model the info types from the content • Implement the info types in an RDB • Model and implement the Navigation • Turn pages into templates
What is a template? A program to display info types and access structures wrapped in static text and formatting
A Web Page template Banner Global Nav Info area: partial views Ads Local nav
A Web area template c.num Navigation (not info) p.title c.name c.image c.date c.Text (p) comment (r) c.name c.email c.site c.text
Web templates vs. CSS • Same • Look and feel • Layout • Different
Templates have • Logic • Conditionals • Loops • Etc. • Commands • Fetch from DB • Put here • Formatting • HTML • CSS • JS If rumor.hasAd = True Select url, hotText from Ad Insert Insert <a href=“” class=“mylink” onMouseOver=“makeBig(this)"”></a>
Page template Calls sub templateCalls in item info or nav logic and info
Key Concept: xsl:call-template You call a template when you need it
Template LOGICAL DESIGN c.num Navigation (not info) p.title c.name c.image c.date c.Text (p) comment (r) c.name c.email c.site c.text
Template markup activity • Download complete copies of the pages we specify • Make sure they run completely locally • For each page • Leave the banner and global nav as is • Find all parts of the page that come form the database • Replace those parts with the markup rules we specify • Be sure not to replace any formatting or layout HTML EXCEPT • Inside text fields • Where there are repeating parts • e.g., in a bullet list of soures, you need markup only one source an put that markup inside a {%%beginRepeat for each ______ … endRepeat%%} • Feel free to finesse a little (if snopes does something inconsistently that you would like to normalize)
Template Markup Rules • For “gets” {%%table.field%%} inside the appropriate HTML • For general logic {%%functionName%%}. Make names that are obvious • For repeating blocks use • {%%beginRepeat for each ______ • HTML and commands • endRepeat%%} • For optional stuff • {%%beginIftable.field=value • HTML and commands • endIf%%}
Pages to do • http://www.snopes.com/sources/vanhitch.htm • http://www.snopes.com/horrors/techno/microwavedpet.asp