Đang chuẩn bị liên kết để tải về tài liệu:
Giải pháp thiết kế web động với PHP - p 38

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

CREATING A DYNAMIC ONLINE GALLERY Finally, you come out of both conditional statements and display “of” followed by the total number of records. 9. Save the page, and reload it in a browser. You still get only the first subset of thumbnails, but you should see the second number change dynamically whenever you alter the value of SHOWMAX. Check your code, if necessary, against gallery_mysqli_07.php, or gallery_pdo_07.php. Navigating through subsets of records As I mentioned in step 3 of the preceding section, the value of the required page is passed to the PHP script through a query string. When the page first loads,. | CREATING A DYNAMIC ONLINE GALLERY Finally you come out of both conditional statements and display of followed by the total number of records. 9. Save the page and reload it in a browser. You still get only the first subset of thumbnails but you should see the second number change dynamically whenever you alter the value of SHOWMAX. Check your code if necessary against gallery_mysqli_07.php or gallery_pdo_07.php. Navigating through subsets of records As I mentioned in step 3 of the preceding section the value of the required page is passed to the PHP script through a query string. When the page first loads there is no query string so the value of curPage is set to 0. Although a query string is generated when you click a thumbnail to display a different image it includes only the filename of the main image so the original subset of thumbnails remains unchanged. To display the next subset you need to create a link that increases the value of curPage by 1. It follows therefore that to return to the previous subset you need another link that reduces the value of curPage by 1. That s simple enough but you also need to make sure that these links are displayed only when there is a valid subset to navigate to. For instance there s no point in displaying a back link on the first page because there isn t a previous subset. Similarly you shouldn t display a forward link on the page that displays the last subset because there s nothing to navigate to. Both issues are easily solved by using conditional statements. There s one final thing that you need to take care of. You must also include the value of the current page in the query string generated when you click a thumbnail. If you fail to do so curPage is automatically set back to 0 and the first set of thumbnails is displayed instead of the current subset. PHP Solution 12-5 Creating the navigation links This PHP solution shows how to create the navigation links to page back and forth through each subset of records. Continue .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.