Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks

          In this example you will create a page view listing users on your site. Through this step-by-step process, you will become familiar with some basic steps in creating a view, and familiarize yourself with the Views User Interface.

          1. Creating a new view

            Go to add new view. Give your new view the name 'user_list', description 'A simple user listing.', tag 'users', type 'User' and click Next.

          2. About the Interface

            You have been brought to the Views User Interface. As you start, you are editing the "Default" options for the view. In the 1st column on the left you can see the drop-down menu offers 'block', for example, to select settings specific only to block views. In the remaining columns, you will be able to add or change options by clicking on links or icons. These options will then appear below this main area. Most likely, you will need to scroll to see the options appear. As you make changes, these options will appear in bold until you save your view.

          3. Creating a page display; choosing a URL and creating a menu link

            1. In the 1st column, ensure that 'Page' is selected in the drop-down menu, and click Add Display.
            2. Next we'll define the path for this page. A page must have a path, and we define it early so that Views doesn't warn us "Display Page uses path but path is undefined." Locate the Page settings in the 2nd column, and click the None link next to the Path setting. In the options editing area that appears below, set the path to 'user_list' (or something else if you prefer) and click Update.
            3. Next to Menu setting, Click the No menu link. In the options which appear below, select Normal menu entry, and set the title to 'User list' and click Update.
            4. Scroll up to Basic settings, in that same 2nd column, and click the No link next to Use pager. Below, in the options, select Full pager and click Update default display.
          4. Selecting the fields to display

            1. In 3rd column locate the Fields options. Click the + icon to add fields.
            2. Scroll down to Defaults: Add fields. In the Groups drop-down menu select 'User', then check the following fields: User: Created date, User: Delete link, User: Edit link, User: Last access, User: Name and User: Picture. Then click Add.
            3. You will be taken through the fields you added one at a time. Click Update default display to go to each next field. Leave the default options on all fields except Delete link; change that field's label to 'Operations'.
            4. Scroll back up to Fields and click the ↑↓ icon to rearrange fields. Down below, drag the Name field, by dragging its four-sided arrow, to the top. Drag the Delete link (Operations) field to the bottom, and the Edit link field just above it. Then click Update.
          5. Seeing what we've done so far

            At this point, you have done enough to create a valid view. If you scroll down, you will see a preview of your view. If it doesn't show already, click the Preview button; but generally this display updates automatically whenever you finish working in one of the mini forms.

          6. Styling the view as a table; combining related fields into columns

            1. Under Basic settings, in the 1st column, click the Unformatted link next to the Style setting. In the options below, under Page: How should this view be styled, choose Table and click Update default display.
            2. You will be taken to a Page: Style options form to edit the table settings. Locate our Edit link field in this mini form, and notice the Column drop-down. Change this drop-down to show Operations. In the Separator column next to the Operations field, type ' | ' (note the spaces around the | symbol). Check all of the Sortable checkboxes, and set Default sort to Name. When finished, click Update default display.
          7. Filtering the user list to exclude unwanted entries

            1. Click the + icon next to Filters.
            2. In the Groups drop-down menu select 'User', then check the User: Name filter, and click Add.
            3. Select Is not one of and enter 'Anonymous' in the Usernames box. Click Update default display.
          8. Adding an argument to list users by role dynamically

            1. Scroll up to Arguments, and click its + icon.
            2. Check the User: Roles argument, and click Add. Set the title to '%1' (don't type the quotes), and under Action to take if argument is not present select Summary, sorted ascending. Leave the other settings as they are. Click Update default display, and click Update through the prompts that follow to accept their default values.
          9. Saving the view

            Finally, click the Save button to save your work. At the very top, click View "Page" to go to your new view!

          posted on 2010-08-18 15:39 seal 閱讀(319) 評論(0)  編輯  收藏 所屬分類: PHP
          主站蜘蛛池模板: 密山市| 乌兰浩特市| 梅河口市| 开封县| 普兰店市| 营口市| 富源县| 柳林县| 惠东县| 刚察县| 洛宁县| 大邑县| 曲松县| 八宿县| 荥经县| 龙山县| 台南县| 安国市| 巴林左旗| 陆河县| 大英县| 察隅县| 平南县| 潢川县| 芦溪县| 教育| 防城港市| 阜平县| 夏河县| 淮滨县| 白河县| 灵璧县| 离岛区| 南宁市| 内丘县| 舒兰市| 新化县| 琼海市| 渝北区| 甘孜县| 阳春市|