Support ⇒ Dragonfly CMS v10 ⇒ BBCodes ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexDragonfly CMS v10

BBCodes Reply to topic


I've modified the default BBCode with some additional [ code ] features:
  • additional parameter: "start=N" (where N is a line number)
  • code=diff and code=ini
  • inline code
Examples:

[ code=diff start=314]
case 'code': # [ CODE ] - if (preg_match('/=([a-z]+)/', $part['code'], $m)) { - $text .= '<code data-type="'.$m[1].'">' . $part['subc'] . '</code>'; + if (preg_match('/=([a-z]+)(?:\s+start=([0-9]+))?/', $part['code'], $m)) { + $text .= '<code data-type="'.$m[1].(empty($m[2])?'':'" style="counter-reset: line '.($m[2]-1)).'">' . $part['subc'] . '</code>'; } else {

This is inline code foo=bar as ini

[ code=ini]
[PHP] ; Maximum allowed size for uploaded files. ; php.net/upload-max-filesize upload_max_filesize = 2M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Tue Jan 16, 2018 12:18 pm; edited 2 times in total


Other examples:

[ code=css]...[ /code]
@media print { body, .body, #body::after { background-color: #fff; } }

[ code=html]...[ /code] / [ code=xml]...[ /code]
<!DOCTYPE html> <html lang="en" tal:attributes="lang 'nl'"> <!-- comment -->

[ code=php]...[ /code]
<?php echo $foo . "string {$foo} data";

[ code=sql]...[ /code]
SELECT FROM tableone INNER JOIN tabetwo USING (column_id) WHERE foo = 'bar'

[ video] /uploads/videos/big_buck_bunny.webm [ /video]


[ video width=320 height=180] /uploads/videos/big_buck_bunny.webm [ /video]

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Wed Jan 24, 2018 10:08 pm; edited 3 times in total

All times are UTC


Jump to: