TelliTip 6: Create a contact page

GraffitiSo you have your fancy new site almost ready, but you realize you want a way for people to contact you.  You need to build a contact form. 

Things to know that will make this simpler:

  • Graffiti themes are comprised of scriptable *.view files that define page contents and layouts.
  • Pages named after these view files will adopt the layout defined on those view files.
  • View files can use macros to output content.  There is a “Contact Us” macro that can be used to generate a contact us form. ContactForm()
  • Your theme may already define a layout (have a view file) for a contact us page.  You’ll want to check before starting.  To check log into the control panel, choose presentation -> themes -> personalize on your theme -> look for a .view file with a contact form.

image

If your theme defines a contact view you probably want to use that for starters.

  1. Record the name of the contact view.  It’s most commonly “contact.view”. image
  2. Click write and create a new post (it can be uncategorized)
  3. Name your post the same name as the contact view file.  “Contact” in my case.
  4. Enter any information in the body you’d like to have on the contact page.
  5. Publish & View your contact page – You should now have a basic contact form as shown to the right.
  6. Now you probably want to add this page to your site navigation. To do this use the Navigation admin under presentation. Presentation > Navigation > Posts > Find the contact post and add it to the site navigation.
  7. You now have a contact form!

image

image

If your theme did not define a contact form. 

  1. Contact the person who built the theme and slap them with a fish.
  2. Personalize your theme… choose presentation -> themes -> personalize on your theme.
  3. Click Create a new file for this theme.
  4. Name it appropriately – this will be the name of your contact page – contactus.view for example will work fine. 🙂
  5. Add “$macros.ContactForm()” to the contents of this file. 
  6. Create a new post with the same name as the view file you just created.
  7. Publish & View your contact page – You should now have a basic contact form as shown to the right.
  8. Now you probably want to add this page to your site navigation. To do this use the Navigation admin under presentation. Presentation > Navigation > Posts > Find the contact post and add it to the site navigation.

NOTE: You’ll notice that this new page doesn’t contain the body of the post you just created.  If you’d like to make the contact form look a little by adding the post contents try pasting the following into the contactus.view in step 5 instead of simply the contact form macro.

<div class=”article”>
  <h1 class=”title”>$post.Title</h1>
  <div class=”body”>
        $post.Body
  </div>
</div>

$macros.ContactForm()