Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 50 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
50
Dung lượng
1,02 MB
Nội dung
Save your work as admin.asp, admin.cfm, or admin.php, depending on the server model you are working with. Now test the results in the browser by pressing F12 (Option+F12). The result looks similar to Figure 25.30. Figure 25.30. Five records are shown in the dynamic table. [View full size image] The Recordset Navigation Bar Now that you have a dynamic table with data, you can use the Recordset Navigation Bar data object to include pagination features, much like the way we did in the previous chapter. Rather than inserting four separate Paging server behaviors along with four separate Show Region server behaviors, as was done in the previous chapter, however, you can use the Recordset Navigation Bar data object to accomplish the task in a few simple clicks. To insert a Recordset Navigation Bar, follow these steps: 1. Place your cursor just below the dynamic table you created in the preceding section and select Insert, Data Objects, Recordset Paging, Recordset Navigation Bar. The Recordset Navigation Bar dialog appears. 2. Make sure that the rsProducts option is selected from the Recordset menu. 3. Choose the Text option button from the Display Using option button group. 4. Click OK. The navigation bar appears on the page similar to Figure 25.31. Notice how all four navigational items are present. The Show Region server behaviors that are attached to this data object cause these items to shift from being visible to invisible, depending on where you are in the recordset. Figure 25.31. The navigation bar is inserted into your page. [View full size image] Save your work and test the results in the browser. The result looks similar to Figure 25.32. Notice that you can page through five records at a time. Figure 25.32. You can now page through five records at a time. [View full size image] Deleting Records Up to this point, we've provided a mechanism for displaying and paging through the data contained in the EmployeeStore table. We've merely provided an alternative method (using data objects) for functionality that was outlined in the previous chapter. This section is where the functionality begins to change. In this section, we'll manually create a new column in the dynamic table, outlining functionality that will allow an administrator to delete certain products from the EmployeeStore table. To add this functionality, follow these steps: 1. Add a new column to the dynamic table by right-clicking the ItemID column and selecting Insert Column from the Table submenu. A new column appears to the left of the ItemID column. 2. Place your cursor in the first cell of the second row and choose Insert, Form, Button. A new button is inserted in the cell. 3. Select the button and change the value to Delete in the Property inspector. Also, select the None option button from the Action option button group. 4. With the button selected, choose Insert, Data Objects, Delete Record. The Delete Record dialog appears. 5. Choose the connVectaCorp option from the Connection menu. 6. Choose the EmployeeStore option from the Delete from Table menu. 7. Choose the rsProducts option from the Select Record From menu. 8. Select the ItemID option from the Unique Key Column menu. 9. Make sure that the form1 option is selected in the Delete by Submitting menu. The formatted Delete Record dialog resembles Figure 25.33. Figure 25.33. Format the Delete Record dialog. [View full size image] Save your work and test the admin page in the browser by pressing F12 (Option+F12). Navigate a few records and click the Delete button. The page refreshes itself, and the selected row disappears. Check the EmployeeStore table to confirm the deletion. Master Detail Page Set The Master Detail Page Set data object is one of the most powerful objects built in to Dreamweaver. It enables you to create a single page with as many fields from the recordset as you like. You can then make one of the items linkable so that it hyperlinks to a detailed page, revealing more detailed information about the linked item. In our example, we'll use the Master Detail Page Set to link the ItemName field to a second page that provides more information about the selected item. How much more information can we provide? Remember that we excluded the Description and ImageURL fields when we created the Recordset earlier in the chapter. Because these fields are relevant to the item, we'll make these visible in a detailed page to which we'll link from the master page. You can work with the Master Detail Page Set by following these steps: 1. Create a new page by selecting File, New. The New Document dialog appears. Select the Page from Template category, pick the VectaCorp<technology> site, where <technology> represents the server model you're working with (ASP, ColdFusion, or PHP), choose the template option, and click Create. 2. Immediately save your page as admin_master.asp, admin_master.cfm, or admin_master.php, depending on the server model you're using. 3. Create a new recordset. To do this, select Insert, Data Objects, Recordset. The Recordset dialog appears. Enter the name rsProducts, select the connVectaCorp connection, choose the EmployeeStore table, and select all the fields from the Columns list. Click OK to create the new recordset. 4. Select the Content Goes Here text in the Content editable region and delete it. With your cursor still in the Content editable region, choose Insert, Data Objects, Master Detail Page Set. The Insert Master- Detail Page Set dialog appears. 5. Make sure that the rsProducts option is selected from the Recordset menu. 6. Select both the ItemDescription and ImageURL fields from the Master Page Fields list and click the Remove (–) button. 7. Select the ItemName field from the Link to Detail From menu. 8. Choose the ItemID option from the Pass Unique Key menu. 9. Choose the All Records option button from the Show option button group. 10. Enter the value admin_detail.asp, admin_detail.cfm, or admin_detail.php (depending on the server model you are using) in the Detail Page Name text box. 11. Leave the Detail Page Fields list box the way it is. The formatted Insert Master-Detail Page Set dialog should resemble Figure 25.34. Figure 25.34. Configure the Insert Master-Detail Page Set dialog accordingly. [View full size image] 12. Click OK. You are immediately taken to the detail page (admin_detail is automatically created for you because that's the name you supplied in the Master Detail Page Set dialog) as shown in Figure 25.35. Save the page. Figure 25.35. The detail page shows all the fields you specified. [View full size image] 13. Switch back to the admin_master.asp, admin_master.cfm, or admin_master.php page. Notice that a dynamic table along with a navigation bar and status are inserted for you. Save your work and test it in the browser. Selecting the ItemName links you to the detail page for that item, revealing more detailed information about the item you selected. Summary As you have progressed through the previous two chapters, you have seen the amazing capabilities that Dreamweaver contains as far as reusable components that not only simplify development but make it much more enjoyable and fun. But it doesn't stop there. As you'll see in the coming chapters, possibilities are virtually limitless: We'll explore creating search functionality, working with a shopping cart, security and user authentication, and more. Chapter 26. Integrating Search Functionality IN THIS CHAPTER Integrating a SQL Search Creating a Search Page Creating the Search Results Page Globalizing the Search Functionality As you have seen, a database exists for the sole purpose of storing data. Tables exist to separate that data into well-structured and meaningful blocks of information that can be accessed at any time in an ordered manner. Most successful websites exist because the information in those sites is relatively easy to access. When you search for a book on Amazon.com, for example, you expect to find it within seconds of being on the site. You type a book name, click Search, and the results appear in a well-structured and elegant manner. If you visit eBay's website in an effort to find that treasure someone might be auctioning off, you type the name of the item you are looking for and select a form object, usually a Submit button, to perform the search. It's safe to say that in today's application service provider business model, most companies employ some mechanism for allowing their users quick access to the data that powers the company. It's true that the Web took off with the inception of the modern search engine. Companies such as Yahoo and Google, for instance, fueled the medium we know as the World Wide Web by making accessible the information contained within billions of websites on the Internet. Employing basic, filtered, and advanced methods of searching, those companies and others powered the Internet into what we know it as today. This chapter focuses on the capability to integrate these search methods into your web application, specifically providing your users with the capabilities to search for information that they need in your site. As you've done with the rest of the chapters in this book, you can work with the examples in this chapter by downloading the files from www.dreamweaverunleashed.com. Remember, you'll want to save the files for Chapter 26 (not the folder) in the C:\Inetpub\wwwroot\VectaCorp<technology> directory, where <technology> represents the server technology (ASP, ASPX, CFM, PHP) you plan to use. Make sure that your site is also properly defined in Dreamweaver as well, including the appropriate server-side technology you plan to use in the Testing Server category. Integrating a SQL Search Finding information in your database can be a simple or a complex process. Depending on the search criteria, you can give your users the capability to narrow their searches as fine as a specific date range. Suppose that you wanted to find all employees in your database who have the name John Smith; you can create a simple queryin Access that selects all the records in the Employees table where the name is equivalent to the name John Smith. Your SQL statement would look something like this: SELECT Name FROM Employees WHERE Name = 'John Smith' The result returns all the matching records. Indeed, the Vecta Corp database is filled with information that users may want access to, including the following: Employees— As an admin, you can perform a search on your Employees table to extract employee- specific information including name, address, city, state, and so on. CreditCards— Again as an admin, you can perform a search on the CreditCards table to extract all the users' credit cards. EmployeeStore— Probably the most important container of information, the EmployeeStore table can be searched by an employee to narrow down an employee's search for a specific product. Orders— As an admin, you can perform a search to determine how many items you sold on a specific day, week, or month. You could also return a statistical analysis of those results so that you could better understand the employees' ordering habits and possibly suggest products in the future. Furthermore, the shipping and receiving department might want to perform a search for all orders that need to be shipped on a specific day or that need to arrive at their destinations by a certain day. This information can help you determine what kind of shipping services to add to the parcel. As you can see, just within the Vecta Corp database, there is plenty available to search on. Whether you are approaching the problem as an admin or an employee, the database ultimately is a warehouse of information. How you access that information is covered next. [...]... Shopping Cart and UltraCart Patch for UD4 extensions from www.dreamweaverunleashed.com After you've downloaded the extensions, unzip the MXP files and double-click them one at a time to install them using the Adobe Extension Manager CS3 as shown in Figure 27.1 The UltraDev Shopping Cart and UltraCart Patch for UD4 appear in the Dreamweaver CS3 extensions list when installed successfully Figure 27.1 Install... full size image] Note You'll no doubt receive complaints from Adobe Extension Manager CS3 regarding the install of these extensions that are nearly eight years old Fear not, however; although Adobe Extension Manager CS3 balks at the installation, rest assured that the installation will proceed and the extensions will work flawlessly in Dreamweaver Integrating the Shopping Cart with the Employee Store... this chapter by downloading the files from www.dreamweaverunleashed.com Remember that you'll want to save the files for Chapter 27 (not the folder) in the C:\Inetpub\wwwroot\VectaCorp directory, where represents the server technology (ASP or ASPX) you plan to use You should also make sure that your site is also properly defined within Dreamweaver, including the appropriate server-side... that stores information the user requests for downloading or purchasing The UltraDev Shopping Cart The UltraDev Shopping Cart (so named because of its original integration with Dreamweaver UltraDev) is the perfect example of Dreamweaver' s flexibility and extensibility in terms of shopping cart integration Written purely in JavaScript by Rick Crawford, the UltraDev Shopping Cart consists of some powerful... examples in this chapter by downloading the files from www.dreamweaverunleashed.com Remember, you'll want to save the files for Chapter 26 (not the folder) in the C:\Inetpub\wwwroot\VectaCorp directory, where represents the server technology (ASP, ASPX, CFM, PHP) you plan to use Make sure that your site is also properly defined in Dreamweaver as well, including the appropriate server-side... developers with the capability to add this virtual shopping cart functionality to their own websites Fortunately for you, Dreamweaver comes through by providing the capability to interact with shopping cart features by using feature-rich extensions you can download right from the Adobe Exchange This chapter discusses the creation of an online shopping cart for the Vecta Corp application The topics covered... server behaviors for adding shopping cart functionality to your web applications If you're using the ColdFusion or PHP server models, review the process as it's covered in ASP, then browse through the Adobe Exchange and pick out a server behavior suite that outlines the topics covered here in your server model of choice The goal is not to pick ASP over other server models, but rather to demonstrate... the search much more dynamic by varying the result based on the parameter being passed in Working with Variables in ASP and PHP Up to this point, we've yet to discuss the topic variables Variables in Dreamweaver' s Recordset dialog allow you to capture user information from sessions, form requests, cookies, and application variables Variables let you work dynamically by passing values from one page... variable Note The ASP and PHP server models support variables; the ASP.NET and ColdFusion server models support parameters Dedicated sections to both ASP.NET and ColdFusion are outlined next Variables in Dreamweaver enable you to capture the data being sent from a previous page, store it, and then use it at any time in the current page Variables contain four properties: Name— The physical name of the variable... component to the template [View full size image] 9 Save the page You should be asked to update all the pages that use the template Click Yes 10 The Update Pages dialog appears, alerting you of the files that Dreamweaver updated 11 Click Close Now close the template and open any page based on that template Preview the page in the browser by pressing F12 (Option+F12) Figure 26.16 shows that no matter what page . Page Set The Master Detail Page Set data object is one of the most powerful objects built in to Dreamweaver. It enables you to create a single page with as many fields from the recordset as you. have progressed through the previous two chapters, you have seen the amazing capabilities that Dreamweaver contains as far as reusable components that not only simplify development but make it. in this book, you can work with the examples in this chapter by downloading the files from www.dreamweaverunleashed.com. Remember, you'll want to save the files for Chapter 26 (not the folder)