Writing code in the forum

Notice: This thread is very old.

11 years ago

David Grudl
Nette Core | 6891
+
0
-

While posting and replying, you can use Texy syntax to enhance your messages.

Code phrases can be surrounded by `backtick quotes`.

Long code blocks write this way:

  /--php
  function importFile($m)
  {
      list(, $file) = $m;
      $level = substr_count($file, '/');
      echo "$file\n";
  }
  \--

or
/--
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .* $0.php [L]
\--

It is possible to use <?php and ?> delimiters to indicate a PHP code:

<?php
function importFile($m)
{
    list(, $file) = $m;
    $level = substr_count($file, '/');
    echo "$file\n";
}
?>

Or use GitHub style:

```php
    list(, $file) = $m;
    $level = substr_count($file, '/');
    echo "$file\n";
```

JavaScript delimites are supported too (the type attribute is optional):

<script type="text/javascript">
function queryMark(url) {
  return (url.indexOf('?') == -1) ? '?' : '&';
}
</script>