michaellunsford Posted July 29, 2006 Share Posted July 29, 2006 I've seen a few folks post code without the dreaded text box -- like the old forum would let you do. I really hate having to scroll in that little box -- especially left and right. How is this posting method done? Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/ Share on other sites More sharing options...
kenrbnsn Posted July 29, 2006 Share Posted July 29, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/#findComment-65498 Share on other sites More sharing options...
zq29 Posted July 29, 2006 Share Posted July 29, 2006 You mean like this?[code=php:0]<?phpfunction 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. Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/#findComment-65538 Share on other sites More sharing options...
michaellunsford Posted July 29, 2006 Author Share Posted July 29, 2006 if only the code tags would wrap the text. Having to scroll right is very annoying.Thanks for the info though. Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/#findComment-65595 Share on other sites More sharing options...
akitchin Posted July 30, 2006 Share Posted July 30, 2006 i imagine there's a good reason it doesn't scroll the text, and that's because if it did so it would be a pain in the *insert body part of choice here* for us to count the lines (god forbid someone actually tell us what line x is). Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/#findComment-66078 Share on other sites More sharing options...
Oldiesmann Posted August 4, 2006 Share Posted August 4, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/15941-code-without-the-text-box/#findComment-69163 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.