Page 1 of 1

Formatted [CODE] Blocks - Who Knew?

Posted: Fri Jul 11, 2014 4:46 pm
by John Adams
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

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;
With =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;
Usage:

Code: Select all

[code=php]My Fancy Code
[/code]

Re: Formatted [CODE] Blocks - Who Knew?

Posted: Fri Jul 11, 2014 7:04 pm
by theFoof
lol that's awesome