Publishers of technology books, eBooks, and videos for creative people

Home > Articles

Like this article? We recommend Connecting the Country Profiles Page to HTML Data

Connecting the Country Profiles Page to HTML Data

Currently, the Country Profiles page (profiles.html) contains a listing in static HTML of the countries to which Newland offers tours. In order to create a page that's easy to maintain when new countries are added or changed, this information should come from a database. We'll use our data file to emulate a database. Therefore, just about all of the content on this page (excluding the banner and footer) is obsolete, so you need to delete it.

Once you have removed all of the old content, you'll need to add a list of links that will let users choose a country profile. This list will come from the HTML dataset you viewed in the previous section. In this step, you'll pull that dataset into this page for use by Spry, both for the list and the detailed profiles.

  1. Open profiles.html in design view.
  2. Drag to select everything on the page, starting from the horizontal rule just above Namibia all the way down to the bottom of the page, including the words Nuevo Peso at the end of the profile of Mexico (see Figure 10).
  3. Press Delete.
  4. The content is removed, and the cursor is left in an empty <p> tag, visible in code or split view, at the bottom of the page.

  5. Replace the first line of body text with the following text (see Figure 11):

    The following list shows all of the countries to which we currently offer tours.
     To learn more about a country, click on its name.

    Here, you are just changing the directions of the page to reflect the new functionality of the page.

  6. Insert your cursor in the blank space below the paragraph you just typed. Click Insert > Spry > Spry Data Set (see Figure 12).
  7. In the Specify Data Source dialog, leave the Select Data Type as HTML. For the Data Set Name, enter ds1, and choose Tables in the Detect box. Next to Specify Data File, browse for countryDetailTable.html and select it. Click the yellow arrow to the left of the table headings (see Figure 13) to identify this table as your data container.
  8. Take a moment to examine the other options in the dialog. Notice that, by changing the Select Data Type setting, you could use the XML file instead of the HTML tables. The Detect drop-down list shows the other types of containers that can serve as data sources. In this example, it's not really necessary to identify the data container, as the page contains only one table. If the page included more than one source (table, div, or list), a yellow arrow would appear next to each, allowing you to identify which container would be the source of your data.

  9. In the Data Containers drop-down list, choose countries. That value comes from the ID attribute of the table that we noted earlier, when looking at the source code of the HTML document. Once the Data Container is selected, the Data Preview at the bottom of the dialog is populated, as shown in Figure 14.
  10. Click the Next button to move to the Set Data Options dialog. In the Column Name drop-down list, choose the population column, and set its Type to number. All others can remain strings. You also have the option of setting a default Sort Column for the data. Choose countryName and set the sort as Ascending (see Figure 15).
  11. Click Next to move to the Choose Insert Options dialog. Select the "Insert table" radio button and click Set Up (see Figure 16). You will choose which fields in the dataset you want to include in your table.
  12. Remove all columns except region and countryName by clicking the minus (-) button next to Columns. Move countryName above region by highlighting the countryName row and clicking the up-arrow button. Make sure that the value for Sortable is set to Yes for each column name. If it isn't, highlight the column name and click the checkbox below the list. Finally, select "Update detail regions when row is clicked" and click OK (see Figure 17).
  13. Click Done to close the Spry Data Set wizard. Switch to code view to see the information that Dreamweaver has inserted into your page.
  14. Remember that Ajax uses JavaScript to manipulate your data. For Spry to use the HTML file you just bound to profiles.html, it needs some JavaScript functionality. Dreamweaver has inserted references to a couple of JavaScript libraries in your page, and will prompt you to move those libraries into your site when you save your document.

    A Spry region has been created, with your Spry table inside it. A Spry region is an area on a page that is bound to a dataset. This region is bound to our HTML dataset, referred to here as ds1, the variable to which you assigned it when first connected to the page.

    If you look in the Bindings panel, you will now see your full dataset, ready for use (see Figure 18). As with a recordset from a database query or columns in an HTML table, these individual variables can be inserted on the page in order to display their dynamic content. You will do just that later in the lesson.

  15. Add the following instruction at the end of the text at the top of the page:
  16. Click column headings to sort.

    When you style the table, you will add a visual indication that the column headings are clickable, but having some simple directions will also aid users.

  17. Save the changes to your file. You will be prompted to copy files into your site directory, creating a SpryAssets folder in the process. Accept the files. Highlight profiles.html in your Files panel and press F12 to preview. You should see the list of country and region names.
  18. That was pretty easy, but what's so special about a Spry table? The columns are sortable! Check this functionality by clicking the column names to sort and then reverse-sort the records. Without Ajax, users would have to refresh the page to sort the records.

  19. The heading for the column containing the names of the countries reflects the name of the database field (countryName). Before you move on, change that heading by capitalizing country and placing a blank space before Name, as shown in Figure 19.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020