Jump to content

code without the text box?


Recommended Posts

You just post your code starting with "<?php" if it's php like this:

<?php
    session_start();
    $just = 'showing an example';
    $of = 'posting without a code box';
    $but = 'there is a problem<br>when trying to post<br>tags';
?>

My own preference is to see all posts in a [nobbc][code][/code][/nobbc] box. It make long lines and long posts much easier to read (IMHO).

Same post in the [nobbc][code][/nobbc]
[code]<?php
    session_start();
    $just = 'showing an example';
    $of = 'posting without a code box';
    $but = 'there is a problem<br>when trying to post<br>tags';
?>[/code]


Ken
You mean like this?
[code=php:0]<?php
function count_to_one_hundred() {
    for($i=1; $i<=100; $i++) echo "$i<br/>";
}
count_to_one_hundred();
?>[/code]

You just enclose your code in [php[b][/b]][/php[b][/b]] tags. Although, I too would prefer to see code within the [code[b][/b]] tags, mainly because I prefer to read code with fixed width characters. It looks neater that way.
There's an easy way to post code without using the code box - just use [nobbc][pre][/pre][/nobbc]. This will preserve spacing/formatting and also display things in an easy-to-read fixed-width font. If you do this though, you should also make sure to select the "Don't use smileys." option under "Additional options..." on the main post screen so that your code won't end up having smileys scattered throughout it.

The horizontal scrolling is done to prevent extra-wide code from stretching out the rest of the page, which is really annoying, especially for those using the dreaded 800x600 resolution...

As akitchin stated, word-wrapping within the code box would make things extremely difficult to read and would make it hard to find specific lines without copying the code and pasting it into notepad or another text editor.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.