Author |
Message |
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: QuÃĐbec
|
Posted: Mon Jun 13, 2011 12:32 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
I didn't test it, just looked at the install file and the files involved. Maybe I'll give it a try someday, but I'm pretty busy these days and I don't really expect anything more to come out of it... |
|
Back to top |
|
|
dondino Board Member
Joined: 09 Dec 2008
Posts: 144
|
Posted: Wed Nov 23, 2011 10:22 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
UP
for drathbun to still look into this and make a fix once and 4 all |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Thu Nov 24, 2011 6:51 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Thanks for the bump. I'll have a look. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Tue Dec 13, 2011 5:48 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Yes please,
Have a look at this.
I thought it might be due to Code: | 'DEFAULT_BOARD_WIDTH' => $new['phpbbdoctor_default_board_width'],
|
in admin/admin_board.php.
I changed it into Code: | 'DEFAULT_BOARD_WIDTH' => $board_config['phpbbdoctor_default_board_width'],
| and it worked.
*Edit* It appears to me that the Full Screen setting doesnīt do anything, 100% is not defined. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Tue Dec 13, 2011 10:10 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
I'll be looking at this over the holidays. I know it works; it's in use on this very board, and it functions. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Tue Dec 13, 2011 10:24 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Okay, thank you.
Yes, I see that on this board the 100% is defined but I didnīt see the same thing on the board where I installed this this morning. Px widths are defined fine but the 100% isn't. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Tue Dec 13, 2011 2:10 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
I believe 100% width or Ful Screen doesnīt work for me because I have set the default width to 960.
As 100% is not in the select array in usercp_register.php well 100% can not be defined by the user.
I have tried to change the array as follows Code: | // BEGIN Set Board Width 1.0.1 (www.phpBBDoctor.com)
$board_widths = array();
$board_widths[] = "960px";
$board_widths[] = "1000px";
$board_widths[] = "1100px";
$board_widths[] = "1200px";
$board_widths[] = "1300px";
$board_widths[] = "1400px";
$board_widths[] = "1500px";
$board_widths[] = "1600px";
$board_widths[] = "1700px";
$board_widths[] = "1800px";
$board_widths[] = "1900px";
$board_widths[] = "100%";
$selected = ($board_width == 0 ? ' selected ' : '');
$s_tmp = '<option value="0"' . $selected .'>' . '100%' . '</option>';
foreach($board_widths as $key => $width)
{
$selected = ($width == $board_width ? ' selected ' : '');
$s_tmp .= '<option value="' . $width . '"' . $selected .'>' . $width . '</option>';
}
$s_board_width = '<select class="post" name="board_width">' . $s_tmp . '</select>';
// END Set Board Width 1.0.1 (www.phpBBDoctor.com) |
But these values donīt get stored in the database. Although I don't know much about types of tables I guess smallint is not the proper type for storing combinations of letters and numbers. I just tried to use a different type Code: | alter table phpbb_users
add user_bo_ard_width varchar(25) not null
after user_style; |
and changed in the MOD code into but stil, the numbers get stored but the letters donīt.
Additionally, I donīt use a <table> as a container for my board but a <div> instead, that's why I had to add the px to the values. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Tue Dec 13, 2011 3:26 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
The text is not stored, the index to the array is stored. An index array value of 0 (zero) is translated to full width or 100%. The other values are stored as 1, 2, 3, ..., and so on, based on this code:
Code: | // BEGIN Set Board Width 1.0.1 (www.phpBBDoctor.com)
$board_widths = array();
$board_widths[] = 800;
$board_widths[] = 850;
$board_widths[] = 900;
$board_widths[] = 950;
$board_widths[] = 1000;
$board_widths[] = 1100;
$board_widths[] = 1200;
$board_widths[] = 1300;
$board_widths[] = 1400;
$board_widths[] = 1500;
$board_widths[] = 1600;
$selected = ($board_width == 0 ? ' selected ' : '');
$s_tmp = '<option value="0"' . $selected .'>' . 'Full Screen' . '</option>';
foreach($board_widths as $key => $width)
{
$selected = ($width == $board_width ? ' selected ' : '');
$s_tmp .= '<option value="' . $width . '"' . $selected .'>' . $width . ' Pixels</option>';
}
$s_board_width = '<select class="post" name="board_width">' . $s_tmp . '</select>';
// END Set Board Width 1.0.1 (www.phpBBDoctor.com) |
So the value in the table is stored as numeric, as it's not storing the pixel width but the index to the pixel width array.
That doesn't solve the original issue mentioned, but the code is working as expected. The "Full Screen" text in the above could really should have been a language variable...
If you have a div rather than a table, then you're not running standard subSilver, right? As long as there is a container div that sets the board width then this MOD should still work, with the proper template adjustments. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Tue Dec 13, 2011 3:46 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Okay, I believe I understand what you are saying about value 0 being stored as 100%.
You're right, it's not subsilver.
What happens is that for a table a numeric value will do for setting the width, but for a div I need a numeric value and something that indicates what that value stands for. I.e. px for a width in pixels or % for a width in percents.
The px value is easy because I simple do Code: | <div style="width:{BOARD_WIDTH}px;> | .
Problem is that if the board_width is 100% this would show in html as Code: | <div style="width:100%px;> |
Not sure if this helps you in understanding what needs to be done but here it is.
I believe your code needs to be changed somehow so that I can store the values in the select literally, 960px, 1200px, 100% and call this value with .
I now see that if I use Code: | // BEGIN Set Board Width 1.0.1 (www.phpBBDoctor.com)
$board_widths = array();
$board_widths[] = 800;
$board_widths[] = 850;
$board_widths[] = 900;
$board_widths[] = 950;
$board_widths[] = 1000;
$board_widths[] = 1100;
$board_widths[] = 1200;
$board_widths[] = 1300;
$board_widths[] = 1400;
$board_widths[] = 1500;
$board_widths[] = 1600;
$selected = ($board_width == 0 ? ' selected ' : '');
$s_tmp = '<option value="0"' . $selected .'>' . 'Full Screen' . '</option>';
foreach($board_widths as $key => $width)
{
$selected = ($width == $board_width ? ' selected ' : '');
$s_tmp .= '<option value="' . $width . '"' . $selected .'>' . $width . ' Pixels</option>';
}
$s_board_width = '<select class="post" name="board_width">' . $s_tmp . '</select>';
// END Set Board Width 1.0.1 (www.phpBBDoctor.com) |
and select "Full Screen" the user_board_width value in the database is 0.
That obviously works fine when using a <table> but is not good for a <div>. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
dondino Board Member
Joined: 09 Dec 2008
Posts: 144
|
Posted: Thu Dec 15, 2011 4:03 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
ohhhh nice to see that there's still interest in this beautiful and useful mod
I know that drathbun will make me a xmas present this year... and will fix my issue
It's been a loooong 3 years... but I have patience, always |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Thu Dec 15, 2011 4:44 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Dondino,
You can fix your issue by doing this. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
dondino Board Member
Joined: 09 Dec 2008
Posts: 144
|
Posted: Thu Dec 15, 2011 5:03 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
oh thanks! will try that code-change!
i thought that drathbun said that it didn't solve the issue mentioned, but maybe he was referring to another code-chage!
will try and let know |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Fri Dec 16, 2011 9:36 am Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
dogs and things wrote: | Dondino,
You can fix your issue by doing this. |
I checked the code here on this site, and in admin_board.php the code is exactly as written in the MOD install notes.
I suspect what is happened is the SQL required to insert the new value into the config table has not been run. That is the most common error on any sort of MOD that sets up a new configuration option. The way the code is written if a value doesn't exist in the database, it's impossible to update. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Fri Dec 16, 2011 4:40 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
I did run the SQL before checking if I could set the board_width from the ACP and couldnīt, after changing Code: | 'DEFAULT_BOARD_WIDTH' => $new['phpbbdoctor_default_board_width'], |
into Code: | 'DEFAULT_BOARD_WIDTH' => $board_config['phpbbdoctor_default_board_width'],
| I could. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
dondino Board Member
Joined: 09 Dec 2008
Posts: 144
|
Posted: Sat Dec 17, 2011 6:33 pm Post subject: Re: User Selectable Board Width 1.0.1 |
|
|
Hi dogs and things
I have just tried your code-change
but even with this modification
I can still not change successfully the board-width from the Admin Control Panel.
When I change the % from there
it gives me the "Forum Configuration Updated Successfully" message,
but when it comes back to the ACP page (refresh)
the % there is still and always the previous one (65%).
so for me it still doesnt work
I even checked inside the database, to see if the query is effectively inside phpbb_config table, and it is, correctly set at 65%:
Image link
dogs and things,
are you sure that the line you suggested is the only thing you have modified from the original mod install.txt ? or you changed also the sql query? |
|
Back to top |
|
|
|