Page 1 of 2

[BETA] Wide Post Scroller

Posted: Thu Jan 29, 2004 4:05 am
by LifeIsPain
Presented of the problem "What is the best way to deal with posts that are too wide for the screen?" I came up with this answer. Using CSS, this MOD will cause a scroll bar to appear at the bottom of the post instead of scrolling the entire page.

In more simple terms, this will keep someone from posting 400 "z"s on a line and having it break your layout.

This has been confirmed to work for Mozilla 1.6, Firebird 0.7, IE 5.0, 5.5, 6.0, and Opera 7.11. It shouldn't mess up any other browsers, but that is why I have it in BETA :P

IE 6.0 users will notice that private messages will not take up 100% of the window like they previously did, but this was necessary for IE 5.0 and 5.5 users to not taka up more than 100% of the window.

And a BIG RED NOTE:
You may not need to edit overall_header.tpl and simple_header.tpl if you have removed the style sheet code from these files. So if you can't find the line I am looking for, stop looking, it probably isn't there (go onto the next file)

As a final note, if there is a name you think would be more appropriate, I am willing to listen.

Code: Select all

##############################################################
## MOD Title: Wide Post Scroller
## MOD Author: LifeIsPain < brian@orvp.net > (Brian Evans) n/a
## MOD Description: This will add a scroll bar for an individual post if
##     this post were to cause the entire screen to have a scroll bar.
## MOD Version: 0.1.0
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: templates/subSilver/overall_header.tpl
##                templates/subSilver/simple_header.tpl
##                templates/subSilver/subSilver.css
##                templates/subSilver/viewtopic_body.tpl
##                templates/subSilver/posting_topic_review.tpl
##                templates/subSilver/privmsgs_preview.tpl
##                templates/subSilver/privmsgs_read_body.tpl
## Included Files: n/a
##############################################################
## Author Notes:
##   You may not need to edit overall_header.tpl and simple_header.tpl if
##   you have removed the style sheet from these files. If you can't find
##   the line I ask for, don't worry about it, go to the next file.
##############################################################
## MOD History:
##
##   2004-01-28 - Version 0.1.0
##      - Initial BETA
##
##############################################################
Download: Current Version (0.1.0)

Posted: Thu Jan 29, 2004 6:32 am
by madnessmotors
I have a modified overall_header for links on the left and with that mod wide posts still make the page side scroll slightly.

Edit: it makes every page scroll slightly.

Posted: Thu Jan 29, 2004 6:47 am
by LifeIsPain
I hate it when I forget to add instructions :(

Ok, this works great for a vanilla install, but there is one thing you need to do now. In overall_header.tpl, simple_header.tpl, and subSilver.css (or perhaps not the first two) look for the following:

Code: Select all

56 + "px"
Ok, play with that 56 and increase the value. 56 was just about right for subSilver, but if you have an extra 110 pixel wide nav bar on a side, you should change the 56 to 166 (or whatever value looks the best).

I tried to get away from this (and by the way, this only effects it when looking at it in IE) and I spent a long time on it, but this is the best I could get IE to give me.

Posted: Thu Jan 29, 2004 6:53 am
by Bradman
This mod already exists at phpbbhacks. It uses css to create scrollbars for those lines of characters with no spaces. It also checks the screen resolution and has different css for each resolution.

Posted: Thu Jan 29, 2004 6:59 am
by madnessmotors
Thanks, got it working good enough for me now.

Posted: Thu Jan 29, 2004 7:11 am
by LifeIsPain
Bradman wrote: This mod already exists at phpbbhacks. It uses css to create scrollbars for those lines of characters with no spaces. It also checks the screen resolution and has different css for each resolution.

This MOD does not exist over there (in full). True, there exists code that uses CSS just as my code does, and the biggest key to the thing ("overflow: auto;") can be found in both MODs, but there are several things that make my code superior (other than the fact I pulled my hair out to get it to work as it does)
  1. For IE, my code does not cause horizontal scrolling of the entire page when the browser is not at full width
    This I believe is the biggest advantage of my code
  2. My code also will apply to the topic review, private messages, and posting review
  3. In IE, the other code will add vertical scroll bars every time it adds horizontal scroll bars
  4. If an extra long username is used (with no spaces) in the other code, it will once again add scroll bars.
  5. Dynamic is better!
And obviously, the code writter has to have some pride. Now to be fair, I didn't know this existed when I wrote my code, but I still wouldn't have used his (because I don't like the idea of having scroll bars if the browser window is not maximised.

Posted: Thu Jan 29, 2004 1:48 pm
by va_group
Thanks Life is pain
i have it installed

it works GREAT! you are THE MAN!

well there some space left over in the leftside
i play around the value of
((typeof width2 != "undefined")?width2.clientWidth:"0") - 56 + "px"); }


but i cant get the scrollbar to the end oft he browser

hehe i enjoying this MOD!!

Posted: Thu Jan 29, 2004 5:30 pm
by LifeIsPain
It is all in the 56. Now, if you have a width that changes, you will want to add nother check for a "width3" but most people don't have that (but I can't tell if you do, your computer isn't sending me the image)

Posted: Thu Jan 29, 2004 10:13 pm
by Bradman
Ah, thanks for pointing out the differences. Sounds good, I'll have to give it a try. :)

Posted: Thu Jan 29, 2004 10:43 pm
by LifeIsPain
va_group: Could I find out which browser you are viewing this page from? It looks like IE, but I don't know what version. It appears that if I found your site correctly, you removed the MOD for now, and that is fine, but it would be good to see the bug in action if you know what I mean (or at least know the url for sure, so I can check the source code for differences).

Posted: Fri Jan 30, 2004 9:32 am
by va_group
ups sorry

Off Topic :
i installed it, well i have a problem last nite where
my OS down couldnt start
i reinstalled OS
and went in(i always have this problem of db which mysql attempt to switch tables between user)
so i installed mysql4.0.17,
well after installed db error
where all people couldnt post(where forum tell him/her please wait)


so i used a backup db of phpbb and a backup forum now
where i havent install the width mod period ^^

_____________________

Addition info:i using IE 6.0 in the screenshot
now................old IE suposed, after refresh OS
i use subsilver.css

i compared ur code and the 1 found in phpbbhack

urs seems more suitable for me
WHY?: urs able to use it in css where i did not included in header
while ,
theirs wrote: #
#-----[ COPY ]------------------------------------------
#
*.css to templates/subSilver/*.css
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
</head>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<script language="JavaScript" type="text/javascript">
<!--
var cssname = false;

if ( screen.width == 800 || screen.width == 1024 || screen.width == 1280 || screen.width == 1600 || screen.width == 1152 || screen.width == 1360 )
{
cssname = screen.width;
}
else
{
cssname = 800;
}

document.write('<link rel="stylesheet" type="text/css" href="templates/subSilver/overflow' + cssname + '.css">');

// -->
</script>


#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
# <td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
width="100%"
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
width="70%"
#
#-----[ IN-LINE FIND ]------------------------------------------
#
valign="top"
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
align="right"
#
#-----[ FIND ]------------------------------------------
# <td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<span class="postbody">
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
<div class="postoverflow">
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.EDITED_MESSAGE}</span>
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
</div>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# End


well theirs use a header js
which is 0.3~0.4kb
for thos who saving bandwidth is not recommend
lol
make it 0.4kb since header load every page no matter where u click on the board
if one day 1 user click 50 times to sulf around you will be extra 20kb
if you have high traffic like 2k members click around daily will be,
40mb per day for this part of mod

sorry if my calculation is wrong
or i talked too much?

last but not least thanks to all author from different mod who contribute

Posted: Sat Jan 31, 2004 1:25 am
by Thoul
There are many different hacks that tackle the problem of widened topic displays, both here at phpBB.com's forums and on other phpBB sites. I've seen at least four or five, not counting this one and my own, which has been previously mentioned in this topic. They all present different solutions that work in different ways. No one of these hacks can truly be called superior to another; each forum admin should use the hack that works best for them and their users in their forum's environment. Most problems in programming can be solved in many different ways. This is one of those cases where there is no "wrong answer." Comparing one hack of this type to another is rather pointless - it's like apples and oranges, to use the old cliche.

You should never assume anything about the amount of time or effort put into developing any hack, however. Just because one person spends a lot of time doing one hack, that doesn't mean another person hasn't spent a lot of time on another hack. Making such an assumption diminishes the spirit of Open Source coding and the world-wide community of phpBB users.

Posted: Sat Jan 31, 2004 7:29 am
by LifeIsPain
Thoul: I meant no disrespect to you, I had not seen a solution for this problem beyond changing the table layout as to allow for the longer post to take up more of the page at the time of my writting. And when I said
LifeIsPain wrote: but there are several things that make my code superior (other than the fact I pulled my hair out to get it to work as it does)
It should be understood that a) I was meaing to say "the ways in which my code is superior" (not the full thing, but features mind you) and b) I never said you didn't pull your hair out or spend any time. I was intending to make reference to the fact that yes, I did actually pull hair out of my head, and it hurt, so "blood" obviously (italics for sarcasm) makes code better.

Why did I make a comparison? I did so because a user said "This mod already exists at phpbbhacks." This is not the case, and so I pointed out how they were different.

That said, yes, I would much prefer using my own code because of the dynamics involved, but that does not make your code less worth of being a MOD.

Posted: Sat Jan 31, 2004 8:52 am
by madnessmotors
I just thought I should let you know this. I had to removed the mod because on a Mac it made all of the posts by my username go one word per line.

Posted: Tue Jan 25, 2005 9:24 am
by spooky2280
Is this MOD still available for download? The download link is broken: "account suspended".