public function base_url($base_url = '', $preserve_query_string = true) {

        // set the base URL
        $base_url = ($base_url == '' ? $_SERVER['REQUEST_URI'] : $base_url);

        // parse the URL
        $parsed_url = parse_url($base_url);

        // cache the "path" part of the URL (that is, everything *before* the "?")
        $this->_properties['base_url'] = $parsed_url['path'];

        // cache the "query" part of the URL (that is, everything *after* the "?")
        $this->_properties['base_url_query'] = isset($parsed_url['query']) ? $parsed_url['query'] : '';

        // store query string as an associative array
        parse_str($this->_properties['base_url_query'], $this->_properties['base_url_query']);

        // should query strings (other than those set in $base_url) be preserved?
        $this->_properties['preserve_query_string'] = $preserve_query_string;

    }
public function base_url($base_url = '', $preserve_query_string = true) {

        // set the base URL
        $base_url = ($base_url == '' ? $_SERVER['REQUEST_URI'] : $base_url);

        // parse the URL
        $parsed_url = parse_url($base_url);

        // cache the "path" part of the URL (that is, everything *before* the "?")
        $this->_properties['base_url'] = $parsed_url['path'];

        // cache the "query" part of the URL (that is, everything *after* the "?")
        $this->_properties['base_url_query'] = isset($parsed_url['query']) ? $parsed_url['query'] : '';

        // store query string as an associative array
        parse_str($this->_properties['base_url_query'], $this->_properties['base_url_query']);

        // should query strings (other than those set in $base_url) be preserved?
        $this->_properties['preserve_query_string'] = $preserve_query_string;

    }
public function base_url ( $ base_url = '' , $ preserve_query_string = true ) { // set the base URL $ base_url = ( $ base_url == '' ? $ _SERVER [ 'REQUEST_URI' ] : $ base_url ) ; // parse the URL $ parsed_url = parse_url ( $ base_url ) ; // cache the "path" part of the URL (that is, everything *before* the "?") $ this -> _properties [ 'base_url' ] = $ parsed_url [ 'path' ] ; // cache the "query" part of the URL (that is, everything *after* the "?") $ this -> _properties [ 'base_url_query' ] = isset ( $ parsed_url [ 'query' ] ) ? $ parsed_url [ 'query' ] : '' ; // store query string as an associative array parse_str ( $ this -> _properties [ 'base_url_query' ] , $ this -> _properties [ 'base_url_query' ] ) ; // should query strings (other than those set in $base_url) be preserved? $ this -> _properties [ 'preserve_query_string' ] = $ preserve_query_string ; }
The base URL to be used when generating the navigation links.

This is helpful for the case when, for example, the URL where the records are paginated may have parameters that
are needed only once and need to be removed for any subsequent requests generated by pagination.

For example, suppose some records are paginated at <i>http://yourwebsite/mypage/</i>. When a record from the list
is updated, the URL could become something like <i>http://youwebsite/mypage/?action=updated</i>. Based on the
value of <i>action</i> a message would be shown to the user.

Because of the way this script works, the pagination links would become:

-   <i>http://youwebsite/mypage/?action=updated&page=[page number]</i> when {@link method} is "get" and
{@link variable_name} is "page";

-   <i>http://youwebsite/mypage/page[page number]/?action=updated</i> when {@link method} is "url" and
{@link variable_name} is "page").

Because of this, whenever the user would paginate, the message would be shown to him again and again because
<i>action</i> will be preserved in the URL!

The solution is to set the <i>base_url</i> to <i>http://youwebsite/mypage/</i> and in this way, regardless of
however will the URL be changed, the pagination links will always be in the form of

-   <i>http://youwebsite/mypage/?page=[page number]</i> when {@link method} is "get" and {@link variable_name}
is "page";

-   <i>http://youwebsite/mypage/page[page number]/</i> when {@link method} is "url" and {@link variable_name} is "page").

Of course, you may still have query strings in the value of the $base_url if you wish so, and these will be
preserved when paginating.

<samp>If you want to preserve the hash in the URL, make sure you load the zebra_pagination.js file!</samp>

@param  string      $base_url                   (Optional) The base URL to be used when generating the navigation
links

Defaults is whatever returned by
{@link http://www.php.net/manual/en/reserved.variables.server.php $_SERVER['REQUEST_URI']}

@param  boolean     $preserve_query_string      (Optional) Indicates whether values in query strings, other than
those set in $base_url, should be preserved

Default is TRUE

@return void
The base URL to be used when generating the navigation links .