code/pagetypes/BrowseCataloguePage.php
/**
     * The index function takes care of getting the parameters and doing the search.
     *
     * @param  SS_HTTPRequest $request
     * @return Array
     */
The index function takes care of getting the parameters and doing the search.
@param  SS_HTTPRequest $request
@return Array
The index function takes care of getting the parameters and doing the search . @param SS_HTTPRequest $request @return Array
public function index(SS_HTTPRequest $request)
    {
        $data = array();
        $this->SearchKeyword = $request->getVar('searchKeyword');
        $page = $request->getVar('page');
        if (!empty($page) && is_numeric($page)) {
            $this->PageNumber = $request->getVar('page');
        }
        if ($this->CatalogueUrl) {
            list($mdArray, $pagination) = $this->searchCatalogue();
            if (!$this->ErrorMessage) {
                if ($pagination['totalPages'] > 0) {
                    $data['records'] = new ArrayList($mdArray);
                    $data['pagination'] = $pagination;
                }
            }
        } else {
            $this->ErrorMessage = "The catalogue to browse has not been configured. Please contact the website administrator.";
        }
        return $data;
    }
public function index ( SS_HTTPRequest $ request ) { $ data = array ( ) ; $ this -> SearchKeyword = $ request -> getVar ( 'searchKeyword' ) ; $ page = $ request -> getVar ( 'page' ) ; if ( ! empty ( $ page ) && is_numeric ( $ page ) ) { $ this -> PageNumber = $ request -> getVar ( 'page' ) ; } if ( $ this -> CatalogueUrl ) { list ( $ mdArray , $ pagination ) = $ this -> searchCatalogue ( ) ; if ( ! $ this -> ErrorMessage ) { if ( $ pagination [ 'totalPages' ] > 0 ) { $ data [ 'records' ] = new ArrayList ( $ mdArray ) ; $ data [ 'pagination' ] = $ pagination ; } } } else { $ this -> ErrorMessage = " The catalogue to browse has not been configured. Please contact the website administrator. " ; } return $ data ; }
The index function takes care of getting the parameters and doing the search.
The index function takes care of getting the parameters and doing the search .
// Get the search keyword and also check for page number. // Check if it contains a value and also is an int. // If the catalogue url has been specified then call function to search/browse the catalogue. // Call the function to get the records. // Check to see if actually any records to display as there might not be any matches for what the user search for. // Populate the array with information. // Return the array so the page is displayed.