PHP Code tags

Where we keep all the boring tidbits about the PHPDN site, the news, and what not.

Moderator: General Moderators

User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: PHP Code tags

Post by Kieran Huggins »

maybe have the expand / contract button open them to full-height instead of closing them? So toggle between a max-height and unrestricted?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: PHP Code tags

Post by John Cartwright »

Kieran Huggins wrote:maybe have the expand / contract button open them to full-height instead of closing them? So toggle between a max-height and unrestricted?
Indeed. The scroll bar is a bit annoying on any decent resolution since your so limited the amount of code viewable..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP Code tags

Post by Christopher »

I agree and was just thinking the same thing.
(#10850)
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: PHP Code tags

Post by VladSun »

Kieran Huggins wrote:maybe have the expand / contract button open them to full-height instead of closing them? So toggle between a max-height and unrestricted?
Then how about adding a default view of it in the User control panel :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PHP Code tags

Post by Chris Corbyn »

Sheesh! 8O All this hacking to do on someone else's code....

/me agrees with everything said...
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Post by matthijs »

Ok, I found out what has to be done about the code blogs: remove the font-family:monospace; It looks illegible. Removing that brings back my beloved font-family Lucida grande as the font used for the code blocks.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PHP Code tags

Post by Chris Corbyn »

matthijs wrote:Ok, I found out what has to be done about the code blogs: remove the font-family:monospace; It looks illegible. Removing that brings back my beloved font-family Lucida grande as the font used for the code blocks.
I'm actually messing around with the syntax tags right now and have just tried what you said. Although it may work nicely with your browser settings, in my FF and in Safari I end up with a non-monospaced font (same as the page maybe?):

Code: Select all

class Foo {
  function bar($x) {
    for ($i = 0; $i < $x; $i++) {
      //something
    }
  }
}
Unfortunately to see the changes on other posts they need to be editted and resubmitted due to the way the BBCode works.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Post by matthijs »

Yes, I also end up with the non-monospaced font, Lucida grande in my case

Code: Select all

stylesheet.css (line 242)
.postbody {
font-family:"Lucida Grande","Trebuchet MS",Helvetica,Arial,sans-serif;
font-size:1.3em;
line-height:1.4em;
}
That's much better.

Should it be mono-space? I also noticed that increasing the font-size a bit also helped a lot.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: PHP Code tags

Post by Weirdan »

matthijs wrote: Should it be mono-space? I also noticed that increasing the font-size a bit also helped a lot.
Are you joking? The code should be displayed in a monospace font, that's for sure. Otherwise all code formatting will go wild. Or were you talking about something else?
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Post by matthijs »

No, I wasn't joking :)

Then just a text-size increase of .1em or something for the code will do the trick. I live-edited the styles for the code block and .1 or .2 was enough to make a big difference. Of course, how something looks will depend on someone's system, so it can never be perfect for everybody. But if code text is tiny for me, having good eyesight, I'm sure more people would appreciate a tiny bit bigger.

But again, the moderators will have to decide what's best, this is just my feedback.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Re: PHP Code tags

Post by JayBird »

matthijs: are you saying it should or shouldn't be monospaced!?

I'm confused :|
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: PHP Code tags

Post by RobertGonzalez »

I think it should be monospace (perhaps even Courier or Courier New) and I think it should be at 9pt. If a fixed size is not appropriate then maybe we can use a relative size compared to the board defaults.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: PHP Code tags

Post by Weirdan »

Everah wrote: If a fixed size is not appropriate then maybe we can use a relative size compared to the board defaults.
relative sizes ftw!
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Post by matthijs »

JayBird wrote:matthijs: are you saying it should or shouldn't be monospaced!?

I'm confused :|
Sorry, I wasn't clear. I just noticed that removing the monospace font, and thereby having a non-monospaced font render the text, made it a lot more readable. But, I didn't think about the spacing issue. A monospace font is, of course, better for code fomatting.

Then the next best thing to do to improve the legibility is to increase the font-size a bit. I know I can do that myself by ctrl+ / cmnd +, but it's annoying to do that for every visit. And besides that, it's not the font-size of the board itself, only the font-size of the code blocks that's too small. In my humble opinion, that is (and for my specific system. But that's a default Mac setting, so wouldn't be too uncommon in the population visiting this forum).
Post Reply