History


Save

For most of you, you'll leave History configured to automatically save the users history for you. Still, it's nice to know how it works, and some of you might prefer to save manually.

Save saves the url of the current page or a specified url into the history.

Parameters

Save has one optional parameter that it accepts.

Name Type Description Default
URL String The URL to save into the history. If not supplied, the URL of the current page is automatically determined. Automatically Determined

Return

Save returns TRUE or FALSE depending on whether it successfully saved. The times it will not be successful is when the page being saved is identical to the previous page or if you have the save_ajax configuration setting set to FALSE and the request was an AJAX request.

Examples

If you have the save_auto configuration setting set to TRUE then you do not need to manually call save on each page, to update the users history. However, if auto saving is off, here's how you manually save the current page:

$this->history->save();

If you wanted to save a specific page, you can do it like so:

$this->history->save('example/page');

It is not necessary to include the base URL, but if you really want to, you can.