|
Displaying of code in forums
|
| Reflectoman |
Posted on 11-05-2006 12:07
|
Senior Member

Posts: 461
Joined: 22.01.06
|
Hi,
I was wondering if this could be modified somehow ... when you are typing up a post and you add in a piece of code, the box that follows surrounding the code is like only half the width of the forum, however if i quote something, then i end up getting a box that is the whole width!
CodeThis is an example of me putting in a piece of code for somebody else to look over.
This is an example of me quoting something somebody said...
is there a way to make the code box wider? I find it annoying having to go back and forth, right and left.
secondly, when people post full copies of their maincore.php or something and we all know how long that is ... it ends up making the post soooooo much longer and you have to scroll and scroll to see what the person has said next after this looooong code, so i was wondering if it was possible to have like a max height of the code box, like 30 lines or so, before the vertical scroller pops in on it, so that way if i dont care to read through all of his maincore.php i can skip over 30 lines and not the pages after pages "non-stop", lol.
just a thought.
Adnan.
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS |
| |
|
|
| sveinungs |
Posted on 11-05-2006 15:42
|
Fusioneer

Posts: 1328
Joined: 05.04.06
|
Hi, Adnan.
There are two files you have to edit to accomplish this.
Step 1
Remove the right side panels in "forum -> veiwthread.php":
In the bottom you find this line:
Coderequire_once BASEDIR."side_right.php";
Delete it, or comment it out like this:
Code//require_once BASEDIR."side_right.php";
Now the right sidepanels don't show when viewing this side, and you'll have space to enlarge the "code-boxes" without messing up the side-layout.
Step 2 - the "codebox"
Edit the file "maincore.php"
Find this, around line 374:
Codefor ($i=0;$i < $ccount;$i++) $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<div class=\'quote\' style=\'width:400px;white-space:nowrap;overflow:auto\'><code style=\'white-space:nowrap\'>\1<br><br><br></code></div>', $text);
Edit it like this (changes marked in red):
Codefor ($i=0;$i < $ccount;$i++) $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<div class=\'quote\' style=\'width:600px;height:300px;white-space:normal;overflow:auto\'><code style=\'white-space:normal\'>\1<br><br><br></code></div>', $text);
NOTE:
width:600px;height:300px - Gives you a codebox of the given size. Change it to your preferences.
NOTE:
white-space:normal - Gives you line breaks in the box, so it remains the width you specify.
You will get an scrollbar (down, not sideways! ;) ) if the box is bigger than the specified height (300px)
I've tested this in IE, Mozilla and Firefox, btw.
How does this look? Follow this link, it's just an example I've made on my site:
http://www.ndime....d=5#post_5 |
| |
|
|
| Reflectoman |
Posted on 11-05-2006 15:48
|
Senior Member

Posts: 461
Joined: 22.01.06
|
thanx for the help ... but the request wasn't quite clear i guess ... i meant it for the forums on this site and on the other support sites .. lol
but now that we have the changes required any chance it can be portrayed into the official support sites? i think it would make the forum posts a bit nicer but muh easier to read (no scrolling right/left).
@hjelp1 - Thank you for the changes, they will go on my site regardless
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS |
| |
|
|
| sveinungs |
Posted on 11-05-2006 16:01
|
Fusioneer

Posts: 1328
Joined: 05.04.06
|
Mission accomplished then
And I agree, it would be nice doing this on the supportsites too. |
| |
|
|
| Digitanium |
Posted on 11-05-2006 18:27
|
Super Admin

Posts: 1559
Joined: 12.04.03
|
Problem is your code 'wraps' which is a bit of a pain, i'm looking for a solution that will limit the height to say 300 pixels. |
| |
|
|
| sveinungs |
Posted on 11-05-2006 19:15
|
Fusioneer

Posts: 1328
Joined: 05.04.06
|
Hi
@Digi:
This will limit the visible height of the codebox to the desired value, yet scrollable if necessary. Don't know if it's exactly valid W3C , nor if this is what your aiming at.
I'll leave that to the ones who "read the manual", just found a solution for my own (selfish) needs...  |
| |
|
|
| WEC |
Posted on 11-05-2006 19:40
|
Fusioneer

Posts: 1418
Joined: 22.10.05
|
Something like this would be pretty ice:
http://phpbb2plus....php?p=105 |
| |
|
|
| SoundreameR |
Posted on 11-05-2006 20:08
|
Junior Member

Posts: 22
Joined: 30.12.05
|
Why do smileys apply to code frame too? Isn't this the sense of code tags, to display program code which is not filtered... |
| |
|
|
| shedrock |
Posted on 11-05-2006 22:24
|
Senior Member

Posts: 380
Joined: 09.12.04
|
A simple solution would be to add some javascript to Expand / Collapse the textbox.
|
| |
|
|
| Reflectoman |
Posted on 13-05-2006 14:06
|
Senior Member

Posts: 461
Joined: 22.01.06
|
@WEC_Admin - yes i like that idea but something a bit larger height wise would be nice ... hehe ... at least like 10 lines or so viewable.
instead of having it 'wrap' can we just have it the same as now, scrollable right/left it its too large (but at least the viewable window will be wider) and of course up and down for those long code sequences.
thanks guys for looking into this ... i was wondering for a while if i was the only one who found it annoying, lol
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS |
| |
|