tailieunhanh - Tạo mạng xã hội với PHP - part 14
Friends and Relationships addTag( 'previous', '' ); } else { $this-registry-getObject('template')-getPage()- addTag( 'first', "First page" ); $this-registry-getObject('template')-getPage()- addTag( 'previous', "getCurrentPage() - 2 ) . "'Previous page" ); } if( $pagination-isLast() ) { $this-registry-getObject('template')-getPage()- addTag( 'next', '' ); $this-registry-getObject('template')-getPage()- addTag( 'last', '' ); } else { $this-registry-getObject('template')-getPage()- addTag( 'first', "getCurrentPage() . "'Next page" ); $this-registry-getObject('template')-getPage()- addTag( 'previous', "getNumPages() - 1 ) . "'Last page" ); } } } To actually display the results of the lookup to the user, we need a template to form our members' list view. This is essentially a copy of the main template. | Friends and Relationships addTag previous else this- registry- getObject template - getPage - addTag first a href members list First page a this- registry- getObject template - getPage - addTag previous a href members list . pagination- getCurrentPage - 2 . Previous page a if pagination- isLast this- registry- getObject template - getPage - addTag next this- registry- getObject template - getPage - addTag last else this- registry- getObject template - getPage - addTag first a href members list . pagination- getCurrentPage . Next page a this- registry- getObject template - getPage - addTag previous a href members list . pagination- getNumPages - 1 . Last page a To actually display the results of the lookup to the user we need a template to form our members list view. This is essentially a copy of the main template file with a template loop for the members information. This is saved in the views default templates members file div id main div id rightside div div id content h1 DINO SPACE Members List h1 -- START members -- p strong name strong p p Keeper of strong dino_name strong a strong dino_gender dino_breed strong p ----------------------------------- 112 --------------------------------- Download from Chapter 4 hr -- END members -- p Viewing page page_number of num_pages p p first previous next last p div div This then displays our users list which currently only contains me as shown below Paginated users by letter As the site grows but before we have such a large user base we need to consider listing more relevant users we are going to end up with a paginated list which isn t particularly easy to navigate. For example if we have 20 users listed on each page and 100 pages of results if our user wants to quickly jump to users with a surname beginning with P it may take them several attempts. To make this easier we can also provide filtering by alphabetical character so the user can click on P and be taken to a list of users with .
đang nạp các trang xem trước