![]() |
Prettifying Pasted Code on TalkPHP
You may notice that when you post code, you can wrap it in a few BBCodes. Mostly we use
[code], [php] and [highlight], as described below.Some people, however, don't wrap their code in any BBCodes at all, which ends up looking messy, and likely to immediately deter people from reading your code, thus replies will be scarce. Option 1: [code]At the very least we should be using this BBCode because at least it preserves white-space, tabbing being the most important. However, when using this BBCode, there is no colour highlighting and so whilst it's acceptable, it's not perfect. This really should be limited to code that is in a language that is unsupported by any other of our BBCodes. Pseudo code, for instance. Option 2: [php]As this is a PHP forum, if you hadn't noticed, I imagine most people will want to use this tag. It is the most popular, and will get the job done nicely. It has all the advantages of the aforementioned BBCode, but with the added nicety of PHP syntax highlighting. This, whilst more than fine, is not quite as advanced as the last of the BBCode tags, but when it comes to PHP highlighting, this or the subsequent will be more than appreciated. One thing though, please do not use this tag for non-PHP code, as the highlighting will likely resemble that of a firework in a paint pot. Option 3: [highlight]This BBCode is something I added to TalkPHP because it allows for much more advanced syntax highlighting. I use this for PHP as well because I find it looks nicer than the antecedent BBCode, but each to their own. The highlight BBCode uses Geshi syntax highlighting, which supports a wide-range of programming languages. To specify the language you wish to place in between the BBCode tags, you can do the following. For example, if you wish to show PHP: [highlight=php]/* PHP code */[/highlight]Albeit this is not a comprehensive list of supported languages, but the ones that are most common on TalkPHP:
|
GeSHi is great, I have it installed on my site. Do we use highlight within php bbcode?
|
You specifying the language using the highlight tag.
[highlight=php]:-) |
no sorry, I meant do we nest it within other tags? I posted some php with some html inside of it, the html showed up as plain text.
|
Because HTML is not PHP, they are separate languages.
|
well yes, I am asking would we use highlight within the php tag to nab the html.
|
Well, we can try.
php Code:
PHP Code:
Code:
<?php |
I don't think it works, does it? :-( It would be nice because people have posted code where it contains both PHP and HTML. If I paste such code then I usually choose the language that is most prevalent in the code.
Don\'t worry about that too much. |
That is a bummer.
|
Hello,
Can we chat? because i know that my query is beyond to solution through quick replies. |
dhaval, stop asking "can we chat?" and start asking actual questions.
Edit: Amazingly, dhaval actually asked a question but it was in reply to this thread instead of a new one. I\'ve since moved it to a new thread. |
Quote:
|
Quote:
|
I don't think it works, does it? It would be nice because people have posted code where it contains both PHP and HTML. If I paste such code then I usually choose the language that is most prevalent in the code.
Don't worry about that too much. |
Great informatiom. I just want to say you thanks for all this.
|
lancel sac
lancel sac
Ici, rire ensemble le pain, les bourses d'huile chatoyantes, Bagage banlieue tag, le l'huile de la peau Cambridge paquet, Meg Shu Nvbao, tout, il ya toujours un bon pour vous. sac lancel Big bag pouvez mettre vos articles préférés ont été chargés dans le report, mais tendre la main et de trouver quelque chose d'embarrassant et gênant lors de l'achat vous dire, lancel bags on sale vous avez besoin d'un compact mini-paquet. lancel bags Mini paquet est petit et exquis achats de faciliter avec, il suffit de mettre quelques points importants peuvent main peut aussi assumer, les points forts, et une gamme d'enfants est également plein. lancel bag sale En particulier, le sac sur le bord dent de requin est son secret incarnations, un pull, ensemble, peuvent vous donner de multiples facettes infection sentiment style, bien sûr, de sécurité et de haute fonctionnalités pratiques en font un rare moment section forfaits chaud.mankag-djia21 http://www.lancelbagsale.com |
| All times are GMT. The time now is 05:54 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0