PHP Code tags

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

Moderator: General Moderators

Re: PHP Code tags

Postby Kieran Huggins » Tue Jan 15, 2008 10:00 am

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
Kieran Huggins
DevNet Master
 
Posts: 3635
Joined: Wed Dec 06, 2006 5:14 pm
Location: Toronto, Canada

Re: PHP Code tags

Postby John Cartwright » Tue Jan 15, 2008 11:31 am

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..
Code: Select all
if ($toBe || $notToBe) echo 'That is the question'; 

NEW HERE?: Please read the Forum Rules, and take the Forum Tour before posting!
User avatar
John Cartwright
Site Admin
 
Posts: 11470
Joined: Tue Dec 23, 2003 3:10 am
Location: Toronto

Re: PHP Code tags

Postby Christopher » Tue Jan 15, 2008 4:06 pm

I agree and was just thinking the same thing.
(#10850)
User avatar
Christopher
Site Administrator
 
Posts: 12649
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP Code tags

Postby VladSun » Tue Jan 15, 2008 6:41 pm

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
VladSun
DevNet Master
 
Posts: 4294
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: PHP Code tags

Postby Chris Corbyn » Tue Jan 15, 2008 9:55 pm

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

/me agrees with everything said...
User avatar
Chris Corbyn
Breakbeat Nuttzer
 
Posts: 13098
Joined: Wed Mar 24, 2004 8:57 am
Location: Melbourne, Australia

Re: PHP Code tags

Postby matthijs » Thu Jan 17, 2008 3:14 am

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.
matthijs
DevNet Master
 
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Postby Chris Corbyn » Thu Jan 17, 2008 4:29 am

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?):

Syntax: [ Download ] [ Hide ]
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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
 
Posts: 13098
Joined: Wed Mar 24, 2004 8:57 am
Location: Melbourne, Australia

Re: PHP Code tags

Postby matthijs » Thu Jan 17, 2008 8:28 am

Yes, I also end up with the non-monospaced font, Lucida grande in my case
Syntax: [ Download ] [ Hide ]
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.
matthijs
DevNet Master
 
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Postby Weirdan » Thu Jan 17, 2008 8:34 am

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?
User avatar
Weirdan
Moderator
 
Posts: 5889
Joined: Mon Nov 03, 2003 7:13 pm
Location: Odessa, Ukraine

Re: PHP Code tags

Postby matthijs » Thu Jan 17, 2008 9:51 am

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.
matthijs
DevNet Master
 
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Re: PHP Code tags

Postby JayBird » Thu Jan 17, 2008 9:56 am

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

I'm confused :|
User avatar
JayBird
Admin
 
Posts: 4522
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK

Re: PHP Code tags

Postby RobertGonzalez » Thu Jan 17, 2008 10:22 am

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
RobertGonzalez
Site Administrator
 
Posts: 14291
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: PHP Code tags

Postby Weirdan » Thu Jan 17, 2008 10:34 am

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!
User avatar
Weirdan
Moderator
 
Posts: 5889
Joined: Mon Nov 03, 2003 7:13 pm
Location: Odessa, Ukraine

Re: PHP Code tags

Postby matthijs » Thu Jan 17, 2008 11:09 am

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).
matthijs
DevNet Master
 
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Previous

Return to Site News

Who is online

Users browsing this forum: No registered users and 3 guests