SUMMARY When selecting a new value for "Images Per Page", the value is only stored for the current session. If you close your browser and then open it again to the 4images site, the value you previously selected is forgotten. Only the default setting from the admin control panel is used.
This mod stores the value the user selects in a cookie so that on subsequent visits the "Images Per Page" is restored to the previously chosen setting.
COMMENTS I chose to use a cookie and not make this part of the user's control panel for a simple reason. Many users, including me, access the same 4images web site from different computers and using monitors with different resolutions. A cookie lets me customize the "Images Per Page" to each monitor.
INSTRUCTIONS Open includes/page_header.php and locate this block of code:
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
$setperpage = intval($HTTP_POST_VARS['setperpage']);
if ($setperpage) {
$site_sess->set_session_var("perpage", $setperpage);
$session_info['perpage'] = $setperpage;
}
}
if (isset($session_info['perpage'])) {
$perpage = $session_info['perpage'];
}
else {
$perpage = ceil($config['default_image_rows'] * $config['image_cells']);
}
REPLACE it with this block:
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
$setperpage = intval($HTTP_POST_VARS['setperpage']);
if ($setperpage) {
$site_sess->set_session_var("perpage", $setperpage);
$session_info['perpage'] = $setperpage;
$site_sess->set_cookie_data("perpage", $setperpage);
}
}
if (isset($session_info['perpage'])) {
$perpage = $session_info['perpage'];
}
else if($site_sess->read_cookie_data("perpage")) {
$perpage = $site_sess->read_cookie_data("perpage");
$site_sess->set_session_var("perpage", $perpage);
$session_info['perpage'] = $perpage;
}
else {
$perpage = ceil($config['default_image_rows'] * $config['image_cells']);
$site_sess->set_cookie_data("perpage", $perpage);
}
That's it. Enjoy!
If you would also like to make the
"Images Per Page" a jump menu, please see this post:
http://www.4homepages.de/forum/index.php?topic=3815.0