CiTi · Computer Coding · Year One · Unit 3
Student Walkthrough
A variable is a name that holds a value. You set it once. Then you can use it anywhere, as many times as you want. Change the value in that one spot, and every place that uses it changes too.
Use a [text] tag: the name, an equals sign, then the value. This prints nothing on the page.
Put the name in square brackets. The server swaps it for the value.
You will keep all your settings in one new file, includes/vars.inc. Every page reads that file first.
Class rule: every variable name is lowercase and ends in var, like pathvar and sitenamevar. That way you can always tell your variables apart from WebDNA’s own tags.
Right now your full site path (/citi/coding/2027/1/YOURINTS/mysite/) is typed all over your site. Open each file and count how many times it appears. In Sublime, Cmd+F (Mac) or Ctrl+F (Windows) and search for /citi/.
Fill these in first. They become the values in your vars.inc.
cssvar, incvar, and imgvar are built from pathvar for you (Step 2).") in your site name. Apostrophes are fine.Do the steps in order. Save in Sublime after each one, then check your live page. Check the box when a step works.
Make the settings file. In CyberDuck, open your mysite/includes folder. Make a New File named vars.inc. Right-click it and choose Edit with Sublime Text.
Type your settings. Use your own values from Part B. One variable per line. No spaces around the =.
Lines starting with [!] are WebDNA comments. The server skips them, so they are a safe place for notes.
Look at the cssvar line: its value uses [pathvar]. The server fills in your path, so cssvar becomes your path plus css/. Only the pathvar line is different for each student. Copy the three lines under it exactly.
Load the settings on your homepage. Open mysite/index.html. Add these two lines at the very top, above your header include. The first line is the only place that still uses your full path.
Switch the homepage include lines to use [incvar]. It already ends with includes/, so just add the file name. Save and check your live page. It should look exactly the same as before.
Update header.inc. Use [cssvar] in the CSS link and [imgvar] for the logo image. Use [titlevar] and [sitenamevar] in the title, and [sitenamevar] in your <h1>.
Check: your browser tab should now say Home | your site name.
Update nav.inc. Every link starts with [pathvar]. Notice there is no / after it: every path variable already ends with one.
Update footer.inc. Use [authorvar] and [sitenamevar] in place of typed names.
Do your other pages (About, Author, Photos). Each page gets the same top lines, but its own titlevar. Change the include lines to [incvar], and change any images in the bodycopy to [imgvar] plus the file name.
Hunt for leftovers. Search every file for /citi/. On each page, the only match should be the vars.inc line. In the three include files, there should be none. Then open every page on your live site and click every nav link.
One change at a time. Predict first, test on your live page, then undo it before the next one.
titlevar line below the header include= on the sitenamevar line[sitenamevar] as [sitnamevar][text]date=hello[/text] to the bottom of vars.inc, then look at your footercssvar line above the pathvar line=. [text]sitenamevar = My Site[/text] does not work, and you get no error message.[sitnamevar] prints as plain text. Capital letters don’t matter, but keep everything lowercase.var. A variable named after a WebDNA tag, like date, takes over the real tag. datevar never will.cssvar, incvar, and imgvar are built from it. If one of them comes first, it stores the plain text [pathvar] and that path breaks.pathvar gets copied into every path built from it and breaks every include.vars.inc first.[incvar] does not exist until that file is read.Change sitenamevar in vars.inc to something new. Check every page and every browser tab. Then change it back (or keep it).
Check each one when you feel confident you can do it.
[incvar]?
Name one change to my site that now takes just one edit
Use this space for anything: questions, reminders, code you want to keep.