4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Chris on June 01, 2005, 01:12:33 AM
-
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
-
I've got the error :(
Fatal error: Call to undefined function: read_cookie_data() in /home/aftertheparty.nl/www/includes/page_header.php on line 300
-
Works great! Thanks for that, it increases usability ;)
Can we use something like that in comments paging? :)
-
Fatal error: Call to undefined function: read_cookie_data()
This is a function that is part of 4images already and it can be found inside includes/sessions.php
Either you have modified that file, unlikely, or you have missed a ; or ) or { } somewhere and this has thrown off the PHP parser. Recheck your code very carefully, restore your clean backup files and try installing the mod again.
-
It works! Thanks for this...
-
Fatal error: Call to undefined function: read_cookie_data()
This is a function that is part of 4images already and it can be found inside includes/sessions.php
Either you have modified that file, unlikely, or you have missed a ; or ) or { } somewhere and this has thrown off the PHP parser. Recheck your code very carefully, restore your clean backup files and try installing the mod again.
Maybe it has something to do with the phpbb intergration which I use.
-
That very well could be and I can only suggest that you carefully check your code for both mods. There is never any gaurantee that 2 mods will work together and if you are not a programmer it may not be possible to locate a conflict and figure out how to fix it if it exists. Good luck.
-
um chris.
And there is no workaround the problem with phpbb?
-
Excellent MOD!! :lol:
-
I installed it without any problems
it's a great mod :D
-
:D and only seconds of work to make it run!!!!
-
Never saw this mod, but works good!!
Thanks Chris :!: :!: (a little over due)
-
Hi,
Thanks Chris !
It is good Idea and nice Work!
Excellent :idea:
m.a
-
This Mod worked exellent with IE6 and Fire Fox. On my PC it donīt work with IE7. Has anybody an idea to make it work there to? Is it just a matter of IE7 settings???