Home
Wiley Dreamweaver CS4 All-in-One For Dummies
Contents
1. Help e n EMBER A 10 11 12 Developing Master and Detail Pages Block by Block 69 Click in the Value column and then click the Dynamic lightning bolt button The Dynamic Data dialog box displays This is where you select the column from the recordset Expand the recordset click the key field and then click OK In this case the key field is empid After you click OK the Parameters dialog box displays the new parame ter and the code that places it into the page dynamically as shown in Figure 1 7 Click OK to close the Parameters dialog box The URL field in the Select File dialog box is pre populated with the new parameter Each dynamic page type has different code that appears because each programming language uses a slightly different syntax to display a URL variable dynamically Fortunately because Dreamweaver is generating the code for you you don t need to know the syntax differences Click Choose to close the Select File dialog box You return to the Document window The name of the detail page appears in the Link field in the Properties inspector The placeholder for the dynamic content is now a link Save your changes to the master page You now have a complete master page Read on to find out how to make the detail page Building detail pages To create a detail page for PHP ASP JSP and ColdFusion page types follow these steps 1 2 Create a new or ope
2. and the URL parameter that the master page uses to find and display that column s record on the detail page If you don t remember the URL parameter name open the master page go to the Bindings panel and look under the DataSet listing To create an ASP NET detail page create a new ASP NET page in Dreamweaver and follow Steps 2 through 12 in the earlier section Building detail pages Note that although the earlier steps show you how to fill out the Recordset dialog box the steps are the same for the DataSet dialog box which you fill out when creating an ASP NET detail page Testing Vour Master and Detail Pages After you create a master and detail page set you need to test those pages Follow these steps to preview the pages in a browser Testing Your Master and Detail Pages 703 1 Open the master page Book IX e 2 uc 2 Choose File gt Preview in Browser Name of Browser 3 When Dreamweaver asks you if it s okay to copy the file to the testing site click OK Your browser launches with your master page see Figure 1 10 4 Click a hyperlink to view the associated detail page for that record safieg j1e 9q pue Jajseyy Guipying In the employee example the linked field is the employee s last name When you click a link the browser page changes to expand the record and display the detail page I SU Be sure that both your master page and detail page transfer to t
3. minus button to remove a field In Figure 1 2 we selected the first_name and last_ name fields These fields appear on the master page in a table format Typically fewer fields appear on the master page than the detail page ges ohp t o E a M Arwe iw imitata Seat crmad ilue MDa gum e MOINS Re ties Jews OUTS Book IX e 5 T safeg reyog pue Jajseyy Guipying 692 Building Master and Detail Pages in One Operation Figure 1 2 The Insert Master Detail Page Set dialog box Insert Master Detail Page Set Master page fields Link to detail from Detail page name Detail page fields OK 7 Cancel sly Recordset employee records HI HE first name last_name Help last name 3 Pass unique key Lempid 4 Show 110 Records at a time All records detail pho HE Browse ER empid a first_name 0 last_name address1 address2 M 10 11 From the Link to Detail From drop down list select the field in the recordset that you want to serve as the link to the detail page This field is the one that a user clicks on to display details for a given employee For example I selected the last name field to serve as the link to the detail page for each record From the Pass Unique Key drop down list select which field contains the values that you want to pass on to the detail page
4. so it can identify the records Typically you select the key field of the table This key field tells the detail page which record to display for the user For our example we selected the empid field Specify the number of records that you want to show at one time on the master page In the example we chose to show 10 records at a time In the Detail Page Name text box enter a name for the detail page or click the Browse button to select an existing file For the example we specify detail php Dreamweaver automatically uses this name when it creates the detail page In the Detail Page Fields area select which records you want to appear on the master page Figure 1 3 The document shows a repeated region navigation objects record counter and a link to the detail page 12 13 693 Building Master and Detail Pages in One Operation Click the plus button and minus button to change the fields that appear on the detail page Typically more fields appear on the detail page than the master page For the example we selected all the fields in the table As you can see Figure 1 2 shows the configuration of the Insert Master Detail Page Set dialog box based on the example values Click OK Dreamweaver creates the master and detail pages and includes dynamic content and server behaviors in both The Document window contains the automatically generated objects a repeated region navigati
5. J Records employee records FirstRecord to employee records LastRecord of employee records TotalRecords bst mme employee_records first_name A7 Q ico 1106x 3648 20K 25ec Unicode 5 0 UTF 8 Book IX e 5 T safieg j1e 9q pue Ja seyy Guipjing 6 9h Developing Master and Detail Pages Block by Block Figure 1 4 The detail page is created automati cally by Dream weaver ar mn i ceil Stotal Rows Detai 1RS2 maxRaws_Detot 1RS1 4 Ws XHTMI Transitianal EN itty waw 3 arg TR xhtnl L UTD xhtnl 1 tronsitional dtd d 379 1999 xhtml gt m ml charseteUTF 8 2 s body el t e i emid php row_DetatLRS1L emp 8 k first rame E hp echo row Jetai amp lost nani lt php echo raw etail amp Sl last name 7 empid DetalRS1 empid first_name DetailRS1 ffrst name kst rame DetalRS1 last name address DetalRS1 address1 address DetailRS address2 city DetalRS city state DetallRS state zp DetaiRS zip deptid DetaiRS1 deptid lt body gt E Q 1o s 1104x2564 7K lsec Unicode S OUTF 8 When you finish designing the pages you re ready to preview your work in a browser See the section Testing Your Master and Detail Pages later in this chapter for details For ASP NET you need to build the master and detail pages separately as described in the section Developing Master
6. MBER we a Chapter 1 Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages for ASP NET Making sure your master and detail pages work S sets of data can be expressed in a simple table much like a traditional spreadsheet But sometimes you don t wish to display complete details on a given table For example suppose you wish to display a master list of employees However you only wish for the full address and department details to be displayed for an employee when that record is selected Dreamweaver enables you to do this by setting up what is known as a master detail relationship You can use Dreamweaver to build master and detail Web pages which are a popular way to display information on your Web site master page displays a list of records and corresponding links for each record A user can click a link to see further information about a record on its associated detail page Depending on your programming language you can either build the set of master and detail pages all in one operation or you can separately build the master pages and then the detail pages You can find out more about both methods in this chapter The examples in this chapter use a simple Employee table which you can see in Table 1 1 The first value the empid is a special field called a Rey It always has a
7. and Detail Pages for ASP NET later in this chapter You can t build these pages at the same time in one operation for ASP NET Developing Master and Detail Pages Block by Block You can develop a master page block by block for PHP ASP JSP and ColdFusion Although you usually create the master and detail pages at the same time you can create them block by block to have complete control over the placement of the blocks Crea ting the master page To create a dynamic master page follow these steps 1 Create a page and define a recordset Turn to Book VIII Chapter 1 to find out how to define a recordset Figure 1 5 The Dynamic Table dialog box Developing Master and Detail Pages Block by Block 695 2 In the Document window place the insertion point where you want the records to appear on the page 3 Choose Insert gt Data Objects Dynamic Data gt Dynamic Table The Dynamic Table dialog box opens as shown in Figure 1 5 Dynamic Table 3 C ok Cancel Recordset employee records Show To Records at a time Help OQ All records Border 1 Cell padding Cell spacing 4 From the Recordset drop down list select the name of the recordset that you want to appear on the master page 5 Specify the number of records that you want to show at one time on the master page In the example we wanted to show 10 records at a time 6 Optionally specify border cell padding
8. and cell spacing 7 Click OK to close the dialog box The master table is created and added to your document If you don t want users to see some of the columns on the master page delete the column from the table by following these steps 1 In Design view click anywhere on the master page 2 Put the pointer near the top of the column so that the column s entries are outlined in red Then click to select the column 3 Click the Delete button to delete the column from the table Setting up links to open a detail page After you create the master page as the preceding section describes you need to create links that open the detail page and communicate which record the user selected so that only the detail for that record displays To set up links to open a detail page follow these steps 1 Open the master page in the Document window Book IX e 5 T safeg reyog pue Jajseyy Guipying 696 Developing Master and Detail Pages Block by Block Figure 1 6 Use the Select File dialog box to configure which page to link to and which parameters to send Figure 1 7 Configuring the URL parameter and its recordset T In the table select the placeholder for the dynamic content on which you want to create a link In the Properties inspector click the folder button next to the Link field The Select File dialog box appears see Figure 1 6 Browse to and select the detail page C
9. detail page select the columns in the Bindings panel and drag those columns onto the detail page Your detail page can now process requests from the master page Figure 1 9 shows the Document window after adding fields from the recordset See the section Testing Your Master and Detail Pages later in this chapter to find out how to preview your master and detail pages in a browser XHTML 1 8 Transitional EN http mmn w3 0rg TR xntmll DTD xhtnlL transttional dec charset UTF 8 gt np echo Srow_enplayes_records Last_nane gt lt p gt ee result Semployee records Errployee ID employee_records empal Name employee records first meme employee records last name lt body gt lt p gt i Q low s 21106 4564 4K lsec Unicode 5 0 UTF 8 Book IX e 5 T safeg reyog pue Jajseyy Guipying 700 Developing Master and Detail Pages for ASP NET Developing Master and Detail Pages for ASP NET hj MBER MBER For ASP NET you can use the DataSet Web control to specify table columns and the DataGrid Web control to list the database records to display on the master page The Web controls provide an easy way to display database data with controls for paging between multiple pages of records You need to define a database connection for the site before you create the master page See Book VII for details Creating a master page To create an ASP NET mas
10. ding the unique key the record ID column for each record and all the table columns that you need to create your detail page Typically you show more columns on the detail page than on the master page For the example in this chapter we created an employee_records recordset and included all the columns in the employee table see Table 1 1 Figure 1 1 Dream weaver with a recordset defined Building Master and Detail Pages in One Operation 69 1 Save your changes to the master page The new recordset appears in the Bindings panel and connection code is automatically added to the dynamic page as shown in Figure 1 1 This page allows a listing of employees to display on the master page Choose Insert Data Objects Master Detail Page Set to insert the master and detail pages all in one operation The Insert Master Detail Page Set dialog box appears see Figure 1 2 You specify the properties for the master page in the top half of this dialog box and the properties for the detail page in the lower half From the Recordset drop down list select the recordset that you want to use for the master page For this example I selected employee_records After you select a recordset Dreamweaver fills in the rest of the fields with the columns from the recordset In the Master Page Fields area select which records you want to appear on the master page Click the plus button to add a field and click the
11. he testing server If not when you click a link in the master page you get a Page not found error message eoo Master H LL ae E A tp richwagnenwords com TMPTICMFATVIN php Fr name Last ame Rich Nelson pacs Bauer peson jBoume Records 1 to 5 of 5 Figure 1 10 The browser displays the master page that uses the data from the databases 70 4 Book IX Developing Applications Rapidly
12. lick the Parameters button to the right of the URL field The Parameters dialog box opens Figure 1 7 shows the dialog box Click the plus button to add a parameter This parameter tells the detail page which row to display Select the key value column as this parameter In the Name column enter the column name You can also click the Dynamic lightning bolt button and select it from the dialog box 4 88 ID E rww test H Q Y SHARED gt Y PLACES Name f gt Gi notes E everest be Macinto Bis Ej Sher amp detail php Connections master php form php _mmServerScripts BI cairparavel Bill dancing pararn php customers php Previous gif Next gif Last gif Fiest gif data test php ERER Bebe En GB rich Ed Desktop L3 airdev G airaops IRL fle Macintosh HD Users rich Sites rww test Sefauk Link Relative To in the site definition Date Modified Today 1 53 PM Today 1 53 PM Today 1 44 PM Today 1 18 PM Wednesday June 18 2008 2 06 PM Wednesday June 18 2008 1 58 PM Wednesday June 18 2008 11 10 AM Wednesday June 18 2008 10 21 AM Wednesday June 18 2008 2 17 AM Wednesday June 18 2008 2 17 AM Wednesday June 18 2008 2 17 AM Wednesday June 18 2008 2 17 AM Tuesday June 17 2008 7 35 PM Cancel Parameters Name Value lt php echo Srow_ lt php echo Srow employee records err ILE C ok Cancel
13. n an existing PHP ASP JSP or ColdFusion page In the Bindings panel click the plus button and select Recordset Query from the menu that appears The simple Recordset dialog box appears If you want to write your own SQL statements click the Advanced button to display the advanced Recordset dialog box In the Name text box enter a name for your recordset You can use only letters numbers and underscores in the name Book IX e 5 uc safeg reyog pue Jajseyy Guipying 698 Developing Master and Detail Pages Block by Block Figure 1 8 Defining a detail recordset Select a database connection for obtaining the data that you want to display Select a table name for obtaining the data that you want to display After you select a table name the database columns appear in the Columns list Select which columns should provide the record data to display Typically your detail page uses more columns than your master page You want the recordset for your detail page to contain at least one column generally the id field that matches the column that you use for the master page Complete the Filter sections as follows The first Filter field Select the database column name that contains values to match against the URL parameter specified in the Setting up links to open a detail page section earlier in this chapter You use the filter to find and display the record specified b
14. nk The URL opens the detail page and uniquely identifies the record to display on the detail page 8 In the Linked Page section click the Browse button next to the Format String box 702 Testing Vour Master and Detail Pages 9 Locate and select which detail page you want to display Note the following when selecting your link page e When you select a detail page Dreamweaver adds information to the URL that specifies a parameter to use to identify the record e Dreamweaver automatically names this parameter based on your database field name but you can change the name to something else if you want to e In any case be sure to note the name of this URL parameter because you need that name when you create the detail page which you can read about in the following section Creating a detail page e Dreamweaver uses a 0 placeholder to indicate where it places the value of the unique identifier when someone accesses the page 10 Click OK to close the Hyperlink Column dialog box 11 Click OK The DataGrid dialog box closes The DataGrid on your page is updated Creating a detail page After you create a master page for ASP NET as described in the two previous sections you need to create a detail page to display the record To do so you need to define a dataset for the record and bind its columns to the detail page When creating the detail page you need to know the database column name that you want to reference
15. on objects record counter and link to the detail page as shown in Figure 1 3 The detail php is created automatically for you You can click the detail php tab in the Document window to see the layout see Figure 1 4 Modify the design of the master and detail pages You can modify your dynamic fields just as you d edit any other object jrnaster php TTTISU osoren phy u Code lir 4 Dosign J Live View v Code Tila Master Heo Fi e FX check Page lt php if Spageham employ T gt href php printf 9is scor s Ad s ScurrentPage mox 0 pugeNum employee records D jehtmls SqueryString employee records gt gt php if SpogeNum employee records Poges employee records a a href pho printfC Xs pageNur or s Sf s ScurrentPage min StotalPages employee records SpageNun employee records 1 SqueryString employee records 7 Next a f SpogeNum employee records lt Sto f pho printfC Xs pageNun enploye lPages employee records gt r sine ScurrentPage StotalPages_ employee records SqueryString employee records gt Records lt php echo startRow employee records 1 gt to lt php echo min stertkow_employee_records totalRows_enplayee_records P gt of lt php echo tatalRows_amployee_records Soxs amp oas employee records nho ul t Semloyre records t Serployee reviens g ss F T A
16. ter page follow these steps 1 Create a new or open an existing ASP NET page in Dreamweaver 2 In the Bindings panel click the plus button and select DataSet Query from the menu that appears The DataSet dialog box appears 3 Complete the DataSet dialog box and then click OK Make sure to include all table columns that you need to create your master page including the unique key Record ID column for each record A dataset is essentially the same thing as a recordset see Book VIII Chapter 1 for more information on recordsets The new dataset appears in the Binding panel 4 In the Server Behaviors panel click the plus button and select DataGrid from the menu that appears The DataGrid dialog box opens 5 Select the dataset source from the DataSet drop down list and click OK You can leave the default column type as Simple Data Field Creating links that open the detail page After you create the ASP NET master page as described in the preceding section you need to create links that open the detail page and communi cate which record the user selected To open an ASP NET detail page and display the specified record follow these steps 1 Open the master page in the Document window Developing Master and Detail Pages for ASP NET 701 2 In the Server Behaviors panel double click DataGrid Book IX e 5 T The DataGrid dialog box appears 3 In the Columns list select the col
17. umn that you want to serve as the link to the detail page You can use any field that identifies the record for expanding the detail of the record safeg reyog pue Jajseyy Guipying 4 Click the Change Column Type button 5 Select Hyperlink from the pop up menu The Hyperlink Column dialog box appears 6 In the Hyperlink Text section specify the text that you want to display in the hyperlink column Here are your choices e Static Text Select this radio button if you want to use a generic description for this column Enter text for the link such as Details Data Field Select this radio button if you want to add text for a link based on a hyperlink column Then from the drop down list select a data field in your dataset In the example we selected the last_ name column Format String This field is automatically generated and shows the format of the URL text 7 In the Linked Page section specify the URL for the hyperlink column text Here are your choices Static Text Select this radio button if you want to use a generic link for this column Enter the URL for the link such as Details aspx Data Field Select this radio button if you want to add a link for data displayed in the hyperlink column Then from the drop down list select a data field in your dataset In the example we selected the first name column Format String This field is automatically generated and shows the format of the URL li
18. unique value Therefore if you query for a record in a table by using the key you always get only the row that you re looking for because no two rows have the same key 690 Building Master and Detail Pages in One Operation Table 1 1 The Employee Table Column Name Type of Data empid Integer firstname 20 character string lastname 20 character string address1 25 character string address2 25 character string city 20 character string state 2 character string zip 10 character string deptid Integer Building Master and Detail Pages in One Operation PHP ASP JSP ColdFusion For PHP ASP JSP and ColdFusion you can build sets of master and detail pages all in one operation You can use the same method for all these languages Creating both the master and detail pages at the same time is generally easier but Dreamweaver gives you the flexibility of creating them separately too To create a master and detail page set for PHP ASP JSP or ColdFusion follow these steps 1 Create a new or open an existing dynamic page A blank page opens in Dreamweaver this page becomes your master page in the language that you selected 2 Define a recordset for the page For the lowdown on creating a recordset check out Book VIII Chapter 1 The recordset provides the data that s displayed on both the master and detail pages Make sure that you include all the table columns that you need to create your master page inclu
19. y the URL parameter passed from the master page The second Filter field Select the equals symbol if it s not already selected This requires the fields to be equal which they must be to display only the record that is detailed The third Filter field Select the URL parameter The fourth Filter field Enter the name of the URL parameter that you want the master page to pass to the detail page The recordset see Figure 1 8 now returns only the data for the employee who s been selected on the master page Recordset Name employee records ok e f Connection employee Define ES Test Table employee Advanced Columns e All Selected 4 Help empid 2 first_name 0 last_name address1 v Filter Cempid m E u URL Parameter 1 empid Sort None 39 Figure 1 9 The Document window after dragging several fields from the recordset onto it Developing Master and Detail Pages Block by Block 699 8 Click the Test button The Test Value dialog box appears 9 Enter a value in the Test Value field and click OK This value represents which detail record displays This test helps you check that the detail page brings back the data you expect A table displaying data from the recordset appears Click OK The Test SQL Statement window closes In the Recordset dialog box click OK 10 11 12 To bind the columns in the recordset to the
Download Pdf Manuals
Related Search
Related Contents
Ver.5.0.1 取扱説明書 User Manual ECOSTEP®54 - Jenaer Antriebstechnik GmbH Craftsman 917.377160 Owner`s manual DRS-100 取扱い説明書の補足説明について () Severin AT2586 Exabyte 221L Ultrium Tape Drive hvljq (ujrqrplfv 3huirupdqfh $ 67$5 ,6 %251 Copyright © All rights reserved.
Failed to retrieve file