PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon May 22, 2017 4:30 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Oct 17, 2011 11:11 am 
Offline
Forum Regular
User avatar

Joined: Wed Apr 30, 2008 2:34 am
Posts: 794
Instead of using [code] or [syntax=somelanguage] to include a block of code, it can be very convenient to just include a small piece of code (a single statement or something) 'inline', i.e. in the middle of your text.

No fancy markup required, to distinguish code from regular text it'd be enough if we could just use a courier new font or something. So you can include something Image within a sentence.

(done with an image here to show what I mean, you get the idea)


Top
 Profile  
 
PostPosted: Mon Oct 17, 2011 3:36 pm 
Offline
Forum Regular
User avatar

Joined: Tue Sep 28, 2010 11:41 am
Posts: 983
Location: Columbus, Ohio
I agree, i end up just using bold to make it stand out, but displaying it as a fixed font would be nicer (especially when it comes to a bit that has a double and a single quote next to each other.)


Top
 Profile  
 
PostPosted: Mon Oct 17, 2011 4:46 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6444
Location: 53.01N x 112.48W
This should be relatively simple to do with a shortcode.

[Edit] [c] has been added. It wraps the text in <code> tags

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
PostPosted: Mon Oct 17, 2011 5:21 pm 
Offline
Forum Regular
User avatar

Joined: Tue Sep 28, 2010 11:41 am
Posts: 983
Location: Columbus, Ohio
So this will be a code (testing it on the quick reply area)...
Syntax: [ Download ] [ Hide ]
$bNiceJob = ($this->works && $im->happy);


Sweet thanks.


Top
 Profile  
 
PostPosted: Tue Oct 18, 2011 10:09 am 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2794
Location: .za
What a coincidence, just a few minutes ago i made a post and wondered if the c behind Font colour was there because the page didn't finish loading but now i know :) I agree about its use, sometimes a block of code is just too heavy for a single line within a reply.

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
PostPosted: Tue Oct 18, 2011 4:22 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6444
Location: 53.01N x 112.48W
I've updated the tag to [inline] as it was getting mixed up with the syntax highlighting plugin. It appears to still be broken if you surround a function name, or more specifically "()" in the tags - so let's consider this a "beta" feature for know.

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
PostPosted: Fri Oct 21, 2011 4:43 am 
Offline
Forum Regular
User avatar

Joined: Wed Apr 30, 2008 2:34 am
Posts: 794
Thanks, although it seems to mess up with pretty much any non-alphabetic character between the tags (e.g. this works vs [inline]this doesn't[/inline] because of the single quote). Perhaps some bbcode regexp is a bit too restricted currently? Same happens with : ; " # $ etc, so that makes it kinda useless for any actual code.

I noticed currently the [inline] tag evaluates to <code class="inline">, maybe it could just use <span class="inline"> for the time being, and later on back to <code> once it doesnt interfere with the syntax highlighting anymore? (I'd rather have non-syntax-highlighted inline code than not-working-at-all :)).

One more request: maybe to make the code stand out a bit more, make the background a bit brighter? Currently, the background color appears to be alternating #e1ebf2 and #ecf3f7, perhaps make the .inline css have background-color:#ffffff for example? (or .inlinecode if .inline is also used for other stuff)


Top
 Profile  
 
PostPosted: Mon Oct 24, 2011 11:16 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6444
Location: 53.01N x 112.48W
I've done no CSS modification for this, so there is certainly room for improvement. Maybe we'll have to find a plugin to do this, or modify the syntax plugin to allow for inline code, as evidently the quick-n-dirty BBCode solution isn't working as we wanted.

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group