<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Layers Magazine &#187; Joseph Lowery</title>
	<atom:link href="http://www.layersmagazine.com/author/joseph-lowery/feed" rel="self" type="application/rss+xml" />
	<link>http://www.layersmagazine.com</link>
	<description>The How-To Magazine for Everything Adobe. Quick tips and tutorials for the entire Adobe Creative Suite.</description>
	<lastBuildDate>Fri, 20 Nov 2009 15:26:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Building a Newsletter App in PHP with Dreamweaver CS3</title>
		<link>http://www.layersmagazine.com/building-a-subscribeunsubscribe-app-in-php-with-dreamweaver-cs3.html</link>
		<comments>http://www.layersmagazine.com/building-a-subscribeunsubscribe-app-in-php-with-dreamweaver-cs3.html#comments</comments>
		<pubDate>Sun, 20 Jan 2008 15:01:49 +0000</pubDate>
		<dc:creator>Joseph Lowery</dc:creator>
				<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.layersmagazine.com/building-a-subscribeunsubscribe-app-in-php-with-dreamweaver-cs3.html</guid>
		<description><![CDATA[E-mail newsletters are a very popular method of maintaining an open channel of communication with your site visitors. They have the great benefit of keeping a site's current user base up-to-date ]]></description>
			<content:encoded><![CDATA[<p>E-mail newsletters are a very popular method of maintaining an open channel of communication with your site visitors. <span id="more-2287"></span>They have the great benefit of keeping a site&#8217;s current user base up-to-date on the latest news and offerings from the organization. Moreover, they have the potential for turning site visitors into site customers or donators.</p>
<p>For newsletters to be successful logistically, they have to be easy to subscribe to and—<strong>just as importantly</strong>—unsubscribe from. With a straightforward entry and exit strategy, many online viewers, leery of incurring additional e-mail spam, will steer clear.<br />
In this article, you&#8217;ll learn how to create a complete subscribe/unsubscribe application in PHP/MySQL with a standard Dreamweaver CS3 server and just one additional block of code. To use this application, a user signs up for a subscription on a site and receives a confirmation e-mail. The e-mail contains a link to unsubscribe, personalized for the user. In all, you&#8217;ll need to create five pages to achieve this functionality:</p>
<ul>
<li><strong>Subscribe.php:</strong> This page is comprised of a basic form that gathers an e-mail address and inserts a new record into the MySQL database. After the record is inserted the page is redirected to confirm_subscribe.php.</li>
<li><strong>Confirm_subscribe.php:</strong> While the visitor sees a bit of text confirming his or her subscription on this page, a PHP function contained within e-mails the user a secondary confirmation, which contains a link to unsubscribe via the confirm_unsubscribe.php page.</li>
<li><strong>Error_subscribe.php:</strong> This is an error page that displays if the e-mail attempt was not successful; it also contains a link to the subscribe.php page so another attempt can be made.</li>
<li><strong>Confirm_unsubscribe.php: </strong>This page is displayed when the visitor requests to unsubscribe. It displays the user&#8217;s e-mail address and a form button to confirm the user&#8217;s wish to unsubscribe; when clicked the user&#8217;s record is deleted from the database and the visitor is redirected to the unsubscribe_complete.php page.</li>
<li><strong>Unsubscribe_complete.php:</strong> The final page in the application acknowledges that the user has unsubscribed.</li>
</ul>
<p></ br>
</p>
<h2>Preliminary set-up</h2>
<p>Before you dive into the page development, let me say a few words about the preliminary set-up.<br />
This PHP application requires a simple MySQL database and a Dreamweaver connection, in addition to a dynamic PHP site set-up on your testing server.<br />
To define a dynamic site follow these steps:</p>
<ol>
<li>Open your Dreamweaver Site Definition dialog box (Sites > Manage Sites > Edit) and select the Testing Server category.</li>
<li>Choose PHP MySQL from the Server Model menu and set up your access. If you&#8217;re working with your own computer as a development system choose Local/Network from the Access list and select the path to the folder on your testing server.</li>
<li>Finally, set the URL to the proper address.</li>
</ol>
<p><a href="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/sub_unsub_files.zip">Here is a folder containing lesson files that you can download and follow along with.</a></p>
<p>The Subscription database consists of a single table, called subs, which in turn has three data columns: ID, SubEmail, and SubSubscriptions (see Figure 1 below). </p>
<p>The ID column is the primary key and uses an integer format that is automatically incremented. The SubEmail column has a text format and is intended to hold the subscribers e-mail addresses. The final column, SubSubscriptions is a Boolean field, intended to note whether a user is currently subscribed or not; a 1 indicates subscribed whereas a 0 means unsubscribed. Although this field is not used in this article in this way—unsubscribed records are deleted—it is included as a possible next step. </p>
<p>One enhancement of the described technique is to keep the user&#8217;s e-mail address on file, in case your site offers other e-mail opportunities than just the newsletter, and toggle the SubSubscriptions field as needed.</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig01.jpg" /><br />
<em>Figure 1</em></p>
<p>The SQL file for the Subscriptions database is included in the sample files that accompany this article
<link to download zip>. You can recreate it on your test server through any number of utilities, including phpMyAdmin, MySQL Control Center or MySQL Administrator.</p>
<p>When you&#8217;ve established your database, it&#8217;s time to create a connection to it in Dreamweaver. To do so, follow these steps:</p>
<ol>
<li>Choose Window > Databases.</li>
<li>Click Add (+)  and choose MySQL Connection from the menu.</li>
<li>In the MySQL Connection dialog box (see Figure 2 below), enter the name of your new connection in the Connection name field (for example, connSubscribe).</li>
<li>Enter an IP address or MySQL server name in the MySQL server field. If you&#8217;re working with a local development system, enter localhost.</li>
<li>Insert your user name and password in the appropriate fields.</li>
<li>Click Select to display the available databases; choose the desired one from the list.</li>
<li>Click Test to verify the connection; when the connection is successful, click OK.</li>
</ol>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig02.jpg" /><br />
<em>Figure 2</em></p>
<p>With your PHP dynamic site, MySQL database, and Dreamweaver connection established, you&#8217;re ready to build the first page of the application.</p>
<h2>Signing up for a subscription</h2>
<p>The subscription page should be simple and clear. You want to keep any barriers to signing up as low as possible. The following example page has a single form field to gather the e-mail address and a submit button, clearly labeled Subscribe Me! (see Figure 3 below).</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig03.jpg" /><br />
<em>Figure 3</em></p>
<p>The text field is named txtEmail by selecting the page element and entering the name in the provided field on the far left of the Property inspector. The form action property is left blank, so the Dreamweaver Insert Record behavior can add its own code. One other form field is inserted into the form: a hidden field labeled SubSubscription with a value of 1. This hidden field will be used by the Insert Record server behavior to populate the identically named field in the database and indicate a subscription has been authorized. Remember that for this Boolean database column, 1 means subscribed.</p>
<p><em>Note: It&#8217;s always a good idea to validate your form fields. You can use the Dreamweaver Validate Form behavior or insert the Spry Validation Text Field if you prefer.</em></p>
<p>To apply the Insert Record server behavior, follow these steps:</p>
<ol>
<li>From the Server Behaviors panel, choose Add (+) and, from the list, select Insert Record.</li>
<li>When the Insert Record dialog box opens, make sure that the current form is selected in the Submit values from list. In my example, I kept the default name, form1.</li>
<li>Choose your connection from the Connection list. Here, my connection is connSubscribe.</li>
<li>Select the table you want to insert your new record into from the Insert table list. My table is called subs.</li>
<li>In the Columns area, you only need to specify a form element for one of the database columns (see Figure 4 below):
<ul>
<li>Leave the first entry—&#8217;ID&#8217; Is an Unused Primary Key—at its default settings.</li>
<li>Select the SubEmail entry and from the Value list, choose FORM.txtEmail and make sure Submit as is set to Text.</li>
<li>Keep the third entry (SubSubscribed) at its default settings. Because you named the hidden form element the same as the database column, Dreamweaver automatically made the assignment for you.</li>
</ul>
</li>
<li>In the After inserting, go to field, enter confirm_subscribe.php.</li>
<li>Click OK and save your page.
<li>
</ol>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig04.jpg" /><br />
<em>Figure 4</em></p>
<h2>Confirming the subscription</h2>
<p>The subscription confirmation page is well-named as it carries out its self-named function in two ways. The text on the page lets your site visitors know that they have successfully signed up. It&#8217;s a great idea to personalize this acknowledgement by repeating their registered e-mail address. A simple Dreamweaver recordset and text binding is needed to accomplish this goal.</p>
<p>You can also use this space to let folks know that a second confirmation has been sent via e-mail with a link for unsubscribing. The text is simple to do in Dreamweaver; the e-mail function takes a bit of handcoding. The e-mail will take advantage of the previously inserted recordset.</p>
<p>Let&#8217;s start by adding the recordset to the page by following these steps:</p>
<p><strong>Step 1:</strong> Open or create your confirm_subscribe.php page. The basic text on the page should be simple and straightforward as shown in Figure 5 below.</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig05.jpg" /><br />
<em>Figure 5</em></p>
<p><strong>Step 2:</strong> From the Bindings panel, click Add (+) and choose Recordset from the list.</p>
<p><strong>Step 3:</strong> When the Recordset dialog box opens (see Figure 6 below), make the following adjustments:</p>
<ul>
<li>Ensure that you&#8217;re in Simple mode and enter an appropriate name for the recordset in the Name field (for example, rsSubscriber).</li>
<li>Choose your data source connection from the Connection list; mine is called connSubscribe.</li>
<li>Select the table from the Table list, like subs.</li>
<li>Leave all the columns selected and the filter at its default setting.</li>
<li>From the Sort lists, choose ID Descending. Do not click OK just yet.</li>
</ul>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig06.jpg" /><br />
<em>Figure 6</em></p>
<p>At this stage (see Figure 6 above), the recordset will return all the records and list the last one entered first; to verify this click Test. However, you don&#8217;t want all the records, you only want one. You can restrict the recordset to the number of records returned with a simple SQL phrase. For this type of customization, you&#8217;ll need to enter the Recordset Advanced mode.</p>
<p><strong>Step 4:</strong> Click Advanced. You can see how your selections in the Simple mode are translated into SQL in the Advanced mode&#8217;s SQL section.</p>
<p><strong>Step 5:</strong> Place your cursor at the end of the SQL code, after ORDER BY ID DESC and enter LIMIT 1 (see Figure 7 below).</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig07.jpg" /><br />
<em>Figure 7 </em></p>
<p>Now, the recordset returns just the single record, which because the data is sorted by the automatically incremented ID field in descending order, is the one just inserted.</p>
<p><strong>Step 6:</strong> Click OK to close the Recordset dialog box. Now that you have some dynamic data coming into the page, you can personalize it.</p>
<p><strong>Step 7:</strong> In Design view, place your cursor in an appropriate spot to display the subscriber&#8217;s e-mail address, like right after the phrase &#8220;…e-mail address&#8221;. Add any necessary punctuation, such as a comma or parentheses. From the Bindings panel, expand the recordset entry, select SubEmail and click Insert (see Figure 8 below). </p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig08.jpg" /><br />
<em>Figure 8</em></p>
<p>The dynamic text is added to the page.</p>
<p><strong>Step 8:</strong> Save your page. </p>
<p>Now that you have a recordset available, you&#8217;re ready to insert the e-mail code. One of the great benefits of PHP is that it has an easy-to-use e-mail method built in. The mail() function looks like this:</p>
<p>mail(address, subject, message[, header[,parameters]])</p>
<p>The first three arguments (e-mail address, subject, and message) are mandatory. The header strings, which typically contains a from address and can also set the MIME type or list CC: and BCC: addresses, is optional. The parameter argument is also optional and is most frequently used for sending additional arguments to configure the output e-mail.</p>
<p>To make the actual function call readable, I like to set up a series of variables with the values assigned, like this: </p>
<p><span style="font-family: Times Roman;">$id = $row_rsSubscriber['ID'];<br />
$to = $row_rsSubscriber['SubEmail'];<br />
$subject = &#8220;Subscription confirmation&#8221;;</span></p>
<p>The first two variables, $id and $to, pull data from the just created recordset that will be incorporated into the e-mail. The third variable, $subject, simply sets the subject line of the message.<br />
Some variables require a lengthy string. I like to use the PHP concatenation operator—the period—to build up the content for such variables, like this:</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig08a.jpg" /></p>
<p>When the variable is fully declared, be sure to conclude with a semi-colon. Although you can send your message in plain text, I thought I&#8217;d show you how to send HTML e-mail in this technique. For HTML e-mail, you&#8217;ll need to add the needed HTML tags to achieve the proper formatting. It&#8217;s important to note the backslashes in the third code line above; they are used to escape the quotation marks within the &#8220;a&#8221; tag.<br />
HTML e-mail also requires setting the e-mail header properly. In addition to defining the From address, you&#8217;ll also need to establish the MIME and content type, like this:</p>
<p>$headers = &#8220;From: Subscription Manager <someoneelse@example.com>\r\n&#8221; .<br />
            &#8220;MIME-Version: 1.0\r\n&#8221; .<br />
            &#8220;Content-type: text/html; charset=UTF-8&#8243;;</p>
<p>The final portion of the code executes the mail() function, but does it in such a way that it redirects the browser to an error page if a problem is encountered. Here&#8217;s the code:</p>
<p>if (!mail($to, $subject, $body, $headers)) {<br />
  header( &#8216;Location: http://www.relativerealty.com/error_subscribe.php&#8217; ) ;</p>
<p>The exclamation mark before the mail() function can be read as NOT, so if the function cannot be executed, the redirecting header() function comes into play.</p>
<p>Let&#8217;s put it all together now in the following steps.<br />
<strong>Step 1:</strong> In the Server Behaviors panel, select the Recordset entry.<br />
<strong>Step 2:</strong> Switch to Code view and press the left arrow to move your cursor outside the recordset code block. Press Enter (Windows) or Return (Mac) to create a new line.<br />
<strong>Step 3:</strong> Enter the following code:</p>
<p><?php<br />
$id = $row_rsSubscriber['ID'];<br />
$to = $row_rsSubscriber['SubEmail'];<br />
$subject = "Subscription confirmation";<br />
$body = "<html><body>&#8221; .<br />
        &#8220;<br />
<h2>Thank you for subscribing to our newsletter!</h2>
<p>&#8221; .<br />
        &#8220;
<p>To unsubscribe, click <a href=\"http://[YOUR SERVER &#038; PATH HERE]/confirm_unsubscribe.php?ID=" . $id . "\">here</a>.</p>
<p>&#8221; .<br />
        &#8220;</body></html>&#8220;;<br />
$headers =  &#8220;From: Subscription Manager <someone@mycompany.com>\r\n&#8221; .<br />
            &#8220;MIME-Version: 1.0\r\n&#8221; .<br />
            &#8220;Content-type: text/html; charset=UTF-8&#8243;;<br />
if (!mail($to, $subject, $body, $headers)) {<br />
  header( &#8216;Location: http://[YOUR SERVER &#038; PATH HERE]/error_subscribe.php&#8217; ) ;<br />
 }<br />
?></p>
<p>Make sure to substitute the placeholder phrases [YOUR SERVER &#038; PATH HERE] with your own server information and the from address (someone@mycompany.com) with your own from address.</p>
<p><strong>Step 4:</strong> Save your page.</p>
<p>To make sure this portion of the page is complete, let&#8217;s quickly create our error page.</p>
<h2>Allowing for errors</h2>
<p>The error page informs site visitors that there has been a problem with the process. It is triggered by the failure of the e-mail function. After informing folks of the problem, you can provide them a link to the subscription page to allow them to re-enter their e-mail addresses and try again (see Figure 9 below).</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig09.jpg" /><br />
<em>Figure 9</em></p>
<p>You can test your application at this point if you like. After publishing the pages to your Web server, go to subscribe.php and enter your e-mail address. The confirmation page will then display, assuming that everything went smoothly, and you will shortly receive your e-mail. If the error page is displayed, you know the e-mail function didn&#8217;t work properly and can start debugging.</p>
<p>Next, let&#8217;s build the page that handles unsubscribing.</p>
<h2>Verifying an unsubscribe request</h2>
<p>The confirm_unsubscribe page is very similar to the confirm_subscribe page. Both use recordsets to define a single record and both use a Dreamweaver server behavior to perform a record management function. When folks are subscribing, the server behavior inserts a new record; when they&#8217;re unsubscribing, a server behavior is used to delete their records.</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig10.jpg" /><br />
<em>Figure 10</em></p>
<p>The structure of the confirm_unsubscribe page will also remind you of its mirror image. Both contain a form with a submit button (see Figure 10 above). They also contain a hidden form element, but there the difference ends. The hidden form element is named ID and has a value that retrieves the ID passed from the URL string:<br />
<?php echo $_GET['ID']; ?><br />
If you don&#8217;t want to type this code into the Value field of the Hidden Form element Property inspector, you can click Add (+) on the Bindings panel and choose URL Variable from the list. When the URL Variable dialog box appears, enter ID in the Name field and click OK. Then you can just insert ID from the Bindings panel into the Value field and Dreamweaver will write the code for you.</p>
<p>Also, you&#8217;ll notice that although there is space for the e-mail address, there is no form. Because you&#8217;re just displaying the data and not asking folks to update or insert it, you can use dynamic text.</p>
<p>Let&#8217;s continue work on the page by inserting the recordset with the following steps:</p>
<p><strong>Step 1:</strong> Open confirm_unsubscribe.php.<br />
<strong>Step 2:</strong> From the Bindings panel, click Add (+) and choose Recordset.<br />
<strong>Step 3:</strong> In the Recordset dialog box (see Figure 11 below), make the following adjustments:</p>
<ul>
<li>Switch to Simple mode and enter a name for the recordset in the Name field; I named mine rsUnsub.</li>
<li>Choose your data source connection from the Connection list; mine is called connSubscribe.</li>
<li>Select the table from the Table list (for example, subs).</li>
<li>Leave all the columns selected at its default setting.</li>
<li>For the Filter settings, choose = for ID and ID for URL Parameter.</li>
<li>This filter checks for a URL parameter named ID and restricts the recordset to whatever its matching value is. For example, if the URL that opened this page was something like http://myco.com/confirm_unsubscribe?ID=8, the recordset would just contain the record with an ID of 8.</li>
<li>Leave Sort at its default setting and click OK.</li>
</ul>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig11.jpg" /><br />
<em>Figure 11</em></p>
<p>Now, let&#8217;s take advantage of our recordset and bring in some dynamic text.<br />
<strong>Step 4:</strong>Place your cursor in the table cell next to the E-mail address label and, from the Bindings panel, expand the Recordset entry. Select SubEmail and click Insert. The placeholder for dynamic text appears.</p>
<p><strong>Step 5:</strong> Save your page.</p>
<p>Now add the server behavior, Delete Record.</p>
<p><strong>Step 1:</strong> From the Server Behaviors panel, click Add (+) and choose Delete Record from the list.<br />
<strong>Step 2:</strong> In the Delete Record dialog box (see Figure 12 below), make the following adjustments:</p>
<ul>
<li>Leave the First check if variable is defined list set to Primary key value.<br />
The check to make sure that the primary key value is defined is a way to ensure that the Submit button was clicked. You would choose another entry, like URL Parameter or Session Variable, only if you wanted to delete the record when the page loaded, without user interaction.</li>
<li>Set the Connections and Table lists to connSubscribe and subs, respectively.</li>
<li>Make sure the Primary key column list is set to ID.</li>
<li>From the Primary key value list, choose Form Variable and enter the ID in the adjacent field.<br />
This is the hidden form field that, you&#8217;ll remember, you set to the URL parameter, ID.</li>
<li>In the After deleting, go to field enter unsubscribe_complete.php.</li>
</ul>
<p><strong>Step 3:</strong> Click OK and save your page.</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig12.jpg" /><br />
<em>Figure 12</em></p>
<p>Just one last page to go—and it&#8217;s a simple one—so let&#8217;s get to it.</p>
<h2>Completing the unsubscribe request</h2>
<p>The unsubscribe_complete page is displayed when the record is deleted. The goal here is to let the visitor know that his or her request to unsubscribe has been honored and that the process is now complete. A simple text page, like the one shown in Figure 13 below, is sufficient.</p>
<p><img src="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/fig13.jpg" /><br />
<em>Figure 13</em></p>
<p>With the application complete, you should post it to your testing server and begin testing. I&#8217;m sure you&#8217;ll think of other variations and enhancements you can add to this basic application. I hope it&#8217;s given you some idea of what&#8217;s possible with Dreamweaver CS3 and PHP as well as providing a solution to extending your Web reach.</p>
<h2>About the author</h2>
<p>Joseph Lowery&#8217;s books about the web and web-building tools are international bestsellers, having sold more than 400,000 copies worldwide in nine different languages. He is the author of the recently published CSS Hacks and Filters as well as the Dreamweaver Bible and Fireworks Bible series from Wiley Publishing. He also wrote Design and Deploy Web Sites with Dreamweaver MX 2004 and Contribute 3 from Macromedia Press. In addition to co-authoring Dreamweaver MX 2004 Web Application Recipes with Eric Ott, he wrote the Dreamweaver MX Killer Tips series with Angela Buraglia.</p>
<p>As a programmer, Joseph contributed two extensions to the latest release of Fireworks and many extensions available for Dreamweaver. He has presented at Seybold in both Boston and San Francisco, Macromedia conferences in the United States and Europe, ThunderLizard&#8217;s Web World, and KW Media Group&#8217;s Mac Design Conference. Joseph is currently the Director of Marketing for WebAssist.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.layersmagazine.com/building-a-subscribeunsubscribe-app-in-php-with-dreamweaver-cs3.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/thumbnail.jpg" length="" type="" />
<enclosure url="http://www.layersmagazine.com/images/tutorials/design/dreamweaver/16/thumbnail.jpg" length="" type="" />
		</item>
		<item>
		<title>Implementing accessibility in Dreamweaver</title>
		<link>http://www.layersmagazine.com/implementing-accessibility-dreamweaver.html</link>
		<comments>http://www.layersmagazine.com/implementing-accessibility-dreamweaver.html#comments</comments>
		<pubDate>Fri, 07 Oct 2005 17:52:52 +0000</pubDate>
		<dc:creator>Joseph Lowery</dc:creator>
				<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.layersmagazine.com/_beta/?p=71</guid>
		<description><![CDATA[On June 21, 2001, Section 508 of the Federal Rehabilitation Act went into effect. As of that date, all federal departments and agencies were mandated to make their websites accessible in accordance with the specific regulations of Section 508. Since that time, Web designers in a wide range of fields, not just federal government, have [...]]]></description>
			<content:encoded><![CDATA[<p>On June 21, 2001, Section 508 of the Federal Rehabilitation Act went into effect. <span id="more-71"></span>As of that date, all federal departments and agencies were mandated to make their websites accessible in accordance with the specific regulations of Section 508. Since that time, Web designers in a wide range of fields, not just federal government, have begun creating pages with accessibility in mind. To many organizations-and thus, to many designers working for them-accessibility makes good business sense. The more accessible a website is, the more people can visit.</p>
<p>Dreamweaver includes a number of mechanisms for helping you to implement the accessibility standard in your webpages. In this step-by-step, you&#8217;ll see how to set up your system to take advantage of the accessibility mechanisms built into Dreamweaver. Understanding where potential violations are is just as important-and in the final section of this tutorial, you&#8217;ll learn how to run Dreamweaver&#8217;s interactive accessibility reports.</p>
<p><img width="430" height="344" src="/images/tutorials/design/dreamweaver/1/step1.jpg" /></p>
<h3 class="step">STEP 1: Setting Up Preferences</h3>
<p>Dreamweaver can help keep you on the accessibility straight and narrow as you build your pages from the ground up. In Dreamweaver, select Dreamweaver>Preferences (or press the keyboard shortcut, Command-U [PC: Control-U]). When the Preferences dialog opens, switch to the Accessibility category. Select the checkbox for each of the page elements: Form Objects, Frames, Media, and Images. Click OK when you&#8217;re done. Although you can opt to enable accessibility options for just form objects or just images, for complete compliance it&#8217;s recommended that all options be selected.</p>
<p><img width="459" height="143" src="/images/tutorials/design/dreamweaver/1/step2.jpg" /></p>
<h3 class="step">STEP 2: Inserting Standard Images</h3>
<p>The Section 508 accessibility requirement for images falls under the category of non-text elements. To enable the visually impaired to access your site, two methods are available: alt or longdesc attributes. Both are attributes of the image tag. From the Insert bar&#8217;s common category, click Image and pick STEP 2 Inserting Standard Images an image from the Select Image Source dialog. Click Choose; the Image Tag Accessibility Attributes dialog opens. Enter a short description in the Alternate Text field. If desired, enter an absolute URL to an HTML file with a longer description of the image in the Long Description field. Click OK.</p>
<p><img width="456" height="78" src="/images/tutorials/design/dreamweaver/1/step3.jpg" /></p>
<h3 class="step">STEP 3: Setting Empty Alt Values</h3>
<p>Not all images on a webpage are intended to be identified by a screen reader-but all images do need an alt attribute regardless. Bullet and spacer images, for example, are typically intentionally ignored by the screen reader. Select the image and in the Alt field, choose Empty from the drop-down menu. With the image selected, switch to Code view and notice the image tag code now includes an attribute like this: alt=&#8221;". When a screen reader encounters an img tag with such an attribute, it skips over it.</p>
<p><img width="451" height="142" src="/images/tutorials/design/dreamweaver/1/step4.jpg" /></p>
<p><!-- MODULE: ads/large_rectangle NOT FOUND --></p>
<h3 class="step">STEP 4: Handling Flash and Other Media</h3>
<p>Like images, Flash and other non-text media require an alternative description of the object under Section 508. The object tag, however, doesn&#8217;t offer an alt attribute, so the title attribute is used instead. To include a title in your Flash code, click the Media: Flash button in the Insert bar&#8217;s Common category. After you&#8217;ve selected your SWF file, the Object Tag Accessibility Attributes dialog is presented. Enter a short description of your Flash movie in the Title field.</p>
<p><img width="446" height="292" src="/images/tutorials/design/dreamweaver/1/step5.jpg" /></p>
<h3 class="step">STEP 5: Working with Form Field Labels</h3>
<p>Online forms present special challenges to those who are using assistive devices. Dreamweaver provides three supplementary aids for each input tag form element inserted: a label, an access key, and a tab index. To automatically generate a label, insert a Text Field (or Text Area, Radio Button, Checkbox, or List/ Menu) from the Forms category of the Insert bar. When the Input Tag Accessibility Attributes dialog opens, enter the desired text in the Label fi eld. If your form uses a table with one column for labels, click the Attach Label Tag Using &#8216;For&#8217; Attribute option.</p>
<p><img width="447" height="299" src="/images/tutorials/design/dreamweaver/1/step6.jpg" /></p>
<h3 class="step">STEP 6: Applying an Access Key and Tab Index</h3>
<p>n addition to correctly identifying the form elements, you also want to provide helpful tools for navigating the form. Both the access key and tab index functions can help in this regard. In the open dialog, enter any letter in the Access Key field. The current field receives focus when the page visitor presses Option (PC: Alt) plus the specified key. In the Tab Index field, enter a number indicating the position of the current field should the user tab through the form; the tab sequence goes from lowest tab index to highest. Click OK when you&#8217;re done.</p>
<p><img width="452" height="326" src="/images/tutorials/design/dreamweaver/1/step7.jpg" /></p>
<h3 class="step">STEP 7: Finishing the Form</h3>
<p>The text field is inserted at the current cursor position with the label next to it. Assuming your form design calls for a right-aligned column for labels, choose the &lt;lable&gt; tag in the Tag Selector and drag it into the leftmost column. After you&#8217;ve inserted all of the form elements and moved their associated labels, select all of the elements in the label column and apply the appropriate CSS style. When you insert the submit button, choose the No Label Tag option in the Input Tag Accessibility Attributes dialog, enter an Access Key letter and a Tab Index number, and click OK.</p>
<p><img width="337" height="352" src="/images/tutorials/design/dreamweaver/1/step8.jpg" /></p>
<h3 class="step">STEP 8: Adding Table Header Rows</h3>
<p>Accessibility options for tables are always available, regardless of your Preferences settings. Section 508 guidelines calls for row and column headers to be identified for data tables. The standard way to accomplish this goal is to use table header tags, &lt;th&gt;, for cells with header information rather than the standard &lt;td&gt; cells. From the Common or Layout categories of the Insert bar, choose Table. In the Header section of the Table dialog, select Left, Top, or Both; click OK. If you examine the code of the inserted table, you&#8217;ll see &lt;th&gt; tags for every cell in your designated header.</p>
<p><img width="412" height="352" src="/images/tutorials/design/dreamweaver/1/step9.jpg" /></p>
<h3 class="step">STEP 9: Initiating Reports</h3>
<p>At various stages of development, after completing a page and before pushing a site live, you&#8217;ll want to make sure your webpages are in compliance with Section 508-and correct any problems, if necessary. Dreamweaver includes a reports feature to help you get an overall picture of the site, including accessibility requirements. To gain access to a report, choose Window>Results or press F7. When the Results panel opens, click the Site Reports tab.</p>
<p><img width="420" height="349" src="/images/tutorials/design/dreamweaver/1/step10.jpg" /></p>
<h3 class="step">STEP 10: Setting Report Scope</h3>
<p>Out of the box, Dreamweaver includes nine different reports. To select which reports to run, click the green arrow in the left of the Results panel. When the Reports panel opens, set the scope of the operation by choosing Entire Current Local Site from the Report On list; you can also examine a single page, fi les selected in the Files panel, or a chosen folder. Reports can be run singly or in combination with other reports. Check the Accessibility option to focus on compliance.</p>
<p><img width="452" height="310" src="/images/tutorials/design/dreamweaver/1/step11.jpg" /></p>
<h3 class="step">STEP 11: Defining Report Settings</h3>
<p>Several of the report types, including Accessibility, allow the user to specify report parameters. With the Accessibility report option highlighted, click Report Settings. The Report Settings dialog allows you to enable or disable accessibility requirements in a number of ways. In our example, only Section 508 accessibility is required and, by default, additional standards are also enabled. To restrict the requirements, fi rst select W3C/WAI_accessibility and then click Disable. Then, highlight 508_accessibility and click Enable. To see which accessibility rules were successfully implemented, click Show &#8220;Passed&#8221; Tests. Click OK when you&#8217;re ready.</p>
<p><img width="452" height="176" src="/images/tutorials/design/dreamweaver/1/step12.jpg" /></p>
<h3 class="step">STEP 12: Running the Report</h3>
<p>Now that the parameters are set, in the Reports dialog, click Run. The dialog closes and the site files are processed; you can follow the operation in the Results panel. When the report has been fully run, you&#8217;ll see a list of entries with a variety of symbols. The immediately identifiable problems are marked with a red X, while the more gray-area issues that require some consideration are noted with a question mark. You can sort the errors by file name, line number, or description.</p>
<p><img width="393" height="346" src="/images/tutorials/design/dreamweaver/1/step13.jpg" /></p>
<h3 class="step">STEP 13: Understanding Errors</h3>
<p>A brief description accompanies each entry, like Non Spacer IMG with Valid ALT, followed by a reference to the accessibility code violated. Both Section 508 and WAI references are included, but only Section 508 errors are flagged. If you&#8217;re not sure what a particular entry&#8217;s problem is-or how to fix it-click the More Info icon on the left side of the Results panel. The Reference panel opens and displays a more in-depth discussion of the accessibility error, testing scenarios, and possible corrective actions to take.</p>
<p><img width="446" height="289" src="/images/tutorials/design/dreamweaver/1/step14.jpg" /></p>
<h3 class="step">STEP 14: Repairing Accessibility Issues</h3>
<p>To fi x fl agged errors, doubleclick any entry to go to the code with the error. If necessary, Dreamweaver opens the referenced page and enters into Split view, with the code highlighted. One of the most common errors is the lack of a valid alt tag for a spacer or shim image. If your Results panel lists such an issue (shown as Spacer IMG with Valid ALT), you can begin to fix it by double-clicking the error entry. With the problem img tag selected, in the Property inspector, select <empty> from the Alt list. Save your page before rerunning the report.</p>
<hr size="1" noshade="noshade" />                 <em>Joseph Lowery is author of the</em> Dreamweaver MX Bible <em>and the</em> Fireworks MX Bible <em>series as well as co-author of the</em> Dreamweaver Killer Tips <em>series. His books are international bestsellers, having sold more than 400,000 copies worldwide in nine different languages.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.layersmagazine.com/implementing-accessibility-dreamweaver.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site building with DW&#8217;s power tools: templates</title>
		<link>http://www.layersmagazine.com/dreamweaver-site-building-templates.html</link>
		<comments>http://www.layersmagazine.com/dreamweaver-site-building-templates.html#comments</comments>
		<pubDate>Fri, 07 Oct 2005 15:54:49 +0000</pubDate>
		<dc:creator>Joseph Lowery</dc:creator>
				<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.layersmagazine.com/_beta/?p=22</guid>
		<description><![CDATA[ Templates are a core tool in Dreamweaver&#8211;and one that&#8217;s gaining in importance and use. Many designers employ templates at the most basic level to ramp up their production efforts; however, an equal number of designers now avoid them because incorrect setup and application left a bad taste. The benefits of templates far outweigh the [...]]]></description>
			<content:encoded><![CDATA[<p><img width="65" height="65" align="left" src="/images/tutorials/design/dreamweaver/2-thumb.jpg" /> Templates are a core tool in Dreamweaver&ndash;and one that&#8217;s gaining in importance and use. <span id="more-22"></span>Many designers employ templates at the most basic level to ramp up their production efforts; however, an equal number of designers now avoid them because incorrect setup and application left a bad taste.<!--more--> The benefits of templates far outweigh the time required to master them and it&#8217;s definitely worth understanding how to do them right.</p>
<p>This is the first of a series of tutorials diving into templates. The goal in this article is to demonstrate proper template-building technique from the ground up. With the rise of the Macromedia Web Publishing System and Contribute, Dreamweaver templates are increasingly important. Old-style templates with one giant editable region are insufficient when creating designs intended for the Contribute audience. In this tutorial, you&#8217;ll also see how to pinpoint your editable regions to maintain the designated styles while still allowing for complete user input.</p>
<p><img width="442" height="349" src="/images/tutorials/design/dreamweaver/2/step1.jpg" /></p>
<h3 class="step">STEP 1: Create Basic Page</h3>
<p>Create or open a page from your site to base your template on. Target your template designs by fashioning templates to serve particular functions. In this example, we&#8217;ll be working with an Intranet newsletter specifically designed for a human resources department. Choose a page with a layout that&#8217;s representative of the type of template you want to make. Be sure the page you select includes most of the elements commonly found on these types of pages. For example, our newsletter includes a photo and a pull-quote, as well as the more common elements such as a logo and edition date.</p>
<p><img width="452" height="249" src="/images/tutorials/design/dreamweaver/2/step2.jpg" /></p>
<h3 class="step">STEP 2: Save as Template</h3>
<p>To begin the process of converting a standard page into a template, choose File>Save As Template. In the Save As Template dialog, which lists all the templates in the current site, enter a meaningful name in the Save As field. This makes it possible for other content contributors working with your template designs to quickly identify the desired template. Dreamweaver then asks if you&#8217;d like to update links. Click Yes. Updating links within a template is crucial; it&#8217;s far better to let Dreamweaver manage your links than to try to figure it out yourself.</p>
<p><img width="391" height="157" src="/images/tutorials/design/dreamweaver/2/step3.jpg" /></p>
<h3 class="step">STEP 3: Mark Initial Editable Regions</h3>
<p>Select the body section of the page where content is enclosed in &#60;p&#62; tags-don&#8217;t include any heading in your selection. From the Insert bar&#8217;s Common category, click Templates: Editable Region. In the New Editable Region dialog, enter a word or phrase in the Name field that accurately describes the content expected for the area and click OK. Replace the specific text for the current page with instructions that indicate the appropriate type of text, suggested length, and any special instructions. When you wrap an editable region around content with one or more &#60;p&#62; tags, that region can be expanded as needed.</p>
<p><!-- BEGIN ADVERT_SQFLOAT --><br />
<!-- END ADVERT_SQFLOAT --></p>
<p><img width="452" height="185" src="/images/tutorials/design/dreamweaver/2/step4.jpg" /></p>
<h3 class="step">STEP 4: Apply Precise Editable Regions</h3>
<p>Switch to Split view so you can see both the page display and code. Select just heading content-make sure you don&#8217;t select the enclosing tags. From the Insert bar, click Templates: Editable Region, enter an appropriate title in the Name field of the dialog, and click OK to confirm your selection. By putting an editable region around just the text, you&#8217;re accomplishing two goals: first, the text entered will be styled as the initial design, and second, you&#8217;re ensuring that only one line of text will be used. An editable region within heading or paragraph tags can&#8217;t be expanded with more tags.</p>
<p><img width="358" height="344" src="/images/tutorials/design/dreamweaver/2/step5.jpg" /></p>
<h3 class="step">STEP 5: Style Template Placeholders</h3>
<p>Wherever necessary, apply CSS classes to style content. Be sure to include instructions in the placeholder text that tell when the style is to be applied and how. For example, to demonstrate how to create a pull-quote, we both show and tell: a portion of the placeholder text is extracted and styled as a pull-quote and the placeholder content details the required steps. CSS classes should only be used where absolutely necessary; it&#8217;s better to apply an ID to a container and let the content be styled contextually.</p>
<p><img width="365" height="344" src="/images/tutorials/design/dreamweaver/2/step6.jpg" /></p>
<h3 class="step">STEP 6: Adding Images and Links to Templates</h3>
<p>If images are used in the layout, replace them with placeholder images. Delete the image and then, from the Insert bar&#8217;s Common category, click Images: Image Placeholder. Set a generic name and the optimum dimensions in the Image Placeholder dialog.</p>
<p>Any links to other pages within the site should be applied by using either the Point to File feature in the Property inspector or the Select File dialog; hand-coding links often leads to an unfound page. The same procedure holds true for any images found in the template: all images or other dependent fi les should be saved outside the Templates folder.</p>
<p><img width="381" height="169" src="/images/tutorials/design/dreamweaver/2/step7.jpg" /></p>
<h3 class="step">STEP 7: Store the Template</h3>
<p>Once you&#8217;ve added all the editable regions required and made sure the rest of the document in the locked areas is suitable, you&#8217;re ready to save your file. Choose File>Save. Because you&#8217;ve already established the file as a template, there&#8217;s no need to select Save as Template. Dreamweaver displays an alert informing you that you&#8217;ve placed an editable region inside a
<p> or other block tag and that, consequently, new paragraphs can&#8217;t be made in this region. Click OK to acknowledge the information. (Unfortunately, this alert appears every time you save the template.)</p>
<p><img width="218" height="321" src="/images/tutorials/design/dreamweaver/2/step8.jpg" /></p>
<h3 class="step">STEP 8: Create Child Page</h3>
<p>To begin the process of making a page based on the just-saved template, choose Window>Assets. In the Assets panel, select the Template category from the icons on the left side-Templates is the second icon from the bottom. Control-click (or Right-click if you have a two-button mouse) on the previously stored template&#8217;s name in the list area and choose New From Template in the shortcut menu. When the new child page appears, choose File>Save to store it. You can save the file anywhere in the site except in the Templates or Library folders.</p>
<p><img width="435" height="260" src="/images/tutorials/design/dreamweaver/2/step9.jpg" /></p>
<h3 class="step">STEP 9: Working with Child Pages</h3>
<p>Make sure Invisible Elements is turned on so you can clearly see the editable regions&#8217; names and outlines. If necessary, choose View>Visual Aids>Invisible Elements. Replace any generic placeholder text with the content for the specific page. When adding images within editable regions, scale them to the proper size (if needed) by resizing them visually to the proper dimensions and then choosing Optimize in Fireworks from the Property inspector. When the Optimize dialog opens, click the File tab to verify the new width and height and then choose Update. Save and close the file when you&#8217;re done.</p>
<p><img width="447" height="311" src="/images/tutorials/design/dreamweaver/2/step10.jpg" /></p>
<h3 class="step">STEP 10: Applying Template to Existing Page</h3>
<p>Sometimes a page is already created and you just want to attach the page to a current template. This allows any updates to the template to be applied to all relevant pages. To handle this situation, open the unattached page and remove all elements except the page-specific content. From the Templates category of the Assets panel, drag-and-drop the desired template onto the page. The Inconsistent Region Names dialog opens to allow you to place existing content correctly. Select the Document body entry and choose the primary editable region from the pop-up menu; for Document head, choose Nowhere.</p>
<p><img width="412" height="211" src="/images/tutorials/design/dreamweaver/2/step11.jpg" /></p>
<h3 class="step">STEP 11: Cleaning Up Child Pages from Existing Files</h3>
<p>Chances are you&#8217;re going to need to move content from the single editable region it was stored in to various other regions. Working in Split view, cut-and-paste content as needed. If there were any meta tags used in the previous unattached document, copy them and paste them in the editable region named head. Why didn&#8217;t we do that before? The Inconsistent Region Names dialog moves all the head content and not just meta tags. Save the file under the original name to replace the unattached version. Keep the file open for a later step.</p>
<p><img width="264" height="342" src="/images/tutorials/design/dreamweaver/2/step12.jpg" /></p>
<h3 class="step">STEP 12: Opening a Template for Alterations</h3>
<p>The ease of creating new pages is only half the benefit derived from templates. The other advantage is that locked areas of any template-derived page can be modifi ed by editing a single file: the template. There are several ways you can open a template for editing. If you know the template&#8217;s name, you can open it from either the Files or the Assets panel by double-clicking on its name. Another approach is to open the file from the associated child page by choosing Modify>Templates>Open Attached Template.</p>
<p><img width="398" height="194" src="/images/tutorials/design/dreamweaver/2/step13.jpg" /></p>
<h3 class="step">STEP 13: Make Change and Save</h3>
<p>Once the template has been opened, you can make any changes you&#8217;d like in either the locked or editable areas. Changes made to the locked regions are applied to all existing and future child pages; alterations made in editable regions are only applied to newly created child pages. After you&#8217;ve made all the desired updates, select File>Save and click OK to dismiss the editable region in block tag alert. When the Update Template Files dialog appears, listing all the child pages, click Update. After the operation is complete, click Close in the Update Pages dialog.</p>
<p><img width="443" height="139" src="/images/tutorials/design/dreamweaver/2/step14.jpg" /></p>
<h3 class="step">STEP 14: Verify</h3>
<p>In this exercise, one child page was intentionally left open and the other closed so you could see the effects of a template update. If you switch to the open child page, you&#8217;ll notice that any changes to the template have been applied- here, a change to the newsletter tag line-but the file needs to be saved. Save the file to complete the update and then open the previously closed child page. Again, all template changes to the locked areas are now transferred to the child page. If any of your pages have been previously published, you&#8217;ll need to re-put them at this point.</p>
<p><em>Joseph Lowery is author of the</em> Dreamweaver MX Bible <em>and the</em> Fireworks MX Bible <em>series as well as co-author of the</em> Dreamweaver Killer Tips <em>series. His books are international bestsellers, having sold more than 400,000 copies worldwide in nine different languages.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.layersmagazine.com/dreamweaver-site-building-templates.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
