September 02 2010 14:20:02
Navigation
IRC Channel
Want to chat?
Join our IRC channel at:
irc.freenode.net #phpfusion

Freenode Webchat

Free IRC Clients: Wikipedia
Support Sites
Donate
View Thread
PHP-Fusion » The Chill Out Zone » General Discussion
 Print Thread
Displaying of code in forums
Reflectoman
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!

Download source  Code
This 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
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:
Download source  Code
require_once BASEDIR."side_right.php";




Delete it, or comment it out like this:
Download source  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:

Download source  Code
for ($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):
Download source  Code
for ($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
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 Grin
------------------------------------------------
Adnan Ahmed Online
File Hosting | Image Hosting | Free SMS
 
sveinungs
Mission accomplished then Smile
And I agree, it would be nice doing this on the supportsites too.
 
Digitanium
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
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... Wink
 
WEC
Something like this would be pretty ice:

http://phpbb2plus....php?p=105
 
SoundreameR
Why do smileys apply to code frame too? Isn't this the sense of code tags, to display program code which is not filtered...Frown
 
shedrock
A simple solution would be to add some javascript to Expand / Collapse the textbox.
phpfusion-themes.com/siriuslogo.jpg
 
Reflectoman
@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
 
Jump to Forum:
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Which PHP version are you using?

4.x or older
4.x or older
7% [24 Votes]

5.0.x
5.0.x
4% [15 Votes]

5.1.x
5.1.x
3% [11 Votes]

5.2.x
5.2.x
27% [96 Votes]

5.3.x or newer
5.3.x or newer
59% [206 Votes]

Votes: 352
You must login to vote.
Started: 15 Jun 2010 23:49:52

Polls Archive
RSS Feeds
- PHP-Fusion News
- SF File Releases
- SF News Releases
Render time: 0.61 seconds - 24 Queries 72,519,227 unique visits