Formatted [CODE] Blocks - Who Knew?
Posted: Fri Jul 11, 2014 4:46 pm
Just a random discovery, brought on by Amadeus asking for non-wrapping CODE blocks. I never knew you could add a "=php" and get nicely formatted code So this is a reminder, since I'll probably forget again.
Without =php
With =php
Usage:
[/code]
Without =php
Code: Select all
switch ($type)
{
case 'php':
// Not the english way, but valid because of hardcoded syntax highlighting
if (strpos($code, '<span class="syntaxdefault"><br /></span>') === 0)
{
$code = substr($code, 41);
}
// no break;
Code: Select all
switch ($type) { case 'php': // Not the english way, but valid because of hardcoded syntax highlighting if (strpos($code, '<span class="syntaxdefault"><br /></span>') === 0) { $code = substr($code, 41); } // no break;Code: Select all
[code=php]My Fancy Code