phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

[RC] User Selectable Board Width 1.0.1

Goto page Previous  1, 2, 3  Next
 
Search this topic... | Search MOD Development... | Search Box
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Author Message
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 430
Location: QuÃĐbec


flag
PostPosted: Mon Jun 13, 2011 4: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


flag
PostPosted: Wed Nov 23, 2011 2:22 pm 
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 icon_mrgreen.gif icon_mrgreen.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 666
Location: Texas


flag
PostPosted: Thu Nov 24, 2011 10:51 pm 
Post subject: Re: User Selectable Board Width 1.0.1

icon_lol.gif Thanks for the bump. I'll have a look.
_________________
phpBBDoctor Blog
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Dec 13, 2011 9:48 am 
Post subject: Re: User Selectable Board Width 1.0.1

Yes please,

Have a look at this. icon_biggrin.gif

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. icon_lol.gif

*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: 666
Location: Texas


flag
PostPosted: Tue Dec 13, 2011 2:10 pm 
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. icon_cool.gif
_________________
phpBBDoctor Blog
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Tue Dec 13, 2011 2:24 pm 
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: 621
Location: Spain


flag
PostPosted: Tue Dec 13, 2011 6: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
Code:
user_board_width
into
Code:
user_bo_ard_width
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: 666
Location: Texas


flag
PostPosted: Tue Dec 13, 2011 7: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... icon_redface.gif

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: 621
Location: Spain


flag
PostPosted: Tue Dec 13, 2011 7: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. icon_smile.gif

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. icon_smile.gif

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
Code:
{BOARD_WIDTH}
.

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


flag
PostPosted: Thu Dec 15, 2011 8: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 icon_smile.gif

I know that drathbun will make me a xmas present this year... and will fix my issue icon_biggrin.gif icon_biggrin.gif

It's been a loooong 3 years... but I have patience, always icon_mrgreen.gif
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Thu Dec 15, 2011 8: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


flag
PostPosted: Thu Dec 15, 2011 9: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 icon_wink.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 666
Location: Texas


flag
PostPosted: Fri Dec 16, 2011 1:36 pm 
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: 621
Location: Spain


flag
PostPosted: Fri Dec 16, 2011 8: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


flag
PostPosted: Sat Dec 17, 2011 10: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 icon_sad.gif

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
Display posts from previous:   
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Page 2 of 3 All times are GMT
Goto page Previous  1, 2, 3  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0316 seconds using 15 queries. (SQL 0.0025 Parse 0.0010 Other 0.0281)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo