In Valid Logic

Endlessly expanding technology

Making a contact form

Had someone ask me over Twitter the other day how to make a contact form like mine in Graffiti.  Here are some quick steps to get it accomplished for you.

  1. Create a post and set its post name to "contact", or something similar and just make a note of it.
  2. In your theme's folder, create a file named "contact.view", or if you created the post with another name, use "post-name.view" (replaces spaces with -).
  3. Fill the contents of the file with the following (key pieces in bold, rest will depend on your theme... the markup below is specific to my site's layout):

            <div id="content">
                 <div class="post">
                    <h1 class="title">$post.Title</h1>
                    <div class="entry">
                        $post.Body
       
                        <p>$macros.ContactForm</p>
                  </div>
                </div>
            </div>

  1. In the Graffiti Control Panel, go to Presentation, Navigation, and add a reference to your Contact post onto your navigation bar.

And there you have it!  With this, your post's title and body will be shown on the page, allowing you to easily manage the content of the page through the control panel, and the macro adds in all the necessary form elements to handle the contact page.

Tuesday, December 11, 2007

 
blog comments powered by Disqus