1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Display html code in my page

Discussion in 'HTML & Website Design' started by mnymkr, Apr 26, 2006.

  1. #1
    I want to display code in my page and have the browser show it as code. i see this done a lot with a nice colored background . how is this done?
     
    mnymkr, Apr 26, 2006 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    An excellent way to do it is with GeSHi... I use it both here in the forum:
    <?php
    	echo 'hello world!';
    ?>
    PHP:
    <html>
    	<head>
    		<title>Hello world!</title>
    	</head>
    	<body>
    		This is stuff in the body!
    	</body>
    </html>
    HTML:
    It has a plug-in system that supports syntax highlighting for 56 languages.
     
    digitalpoint, Apr 26, 2006 IP
  3. son

    son Peon

    Messages:
    207
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    <*code*></*code*> without the *?

    I think you could also use <*pre*>.
     
    son, Apr 27, 2006 IP
  4. tayiper

    tayiper Active Member

    Messages:
    421
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #4
    ... precisely, as you've said it, however, in particular for the code that needs to start each line in a new line I prefer the "pre" tags, or better yet, the "code" tags would not work at all in this case (without additionaly styling them)


    tayiper
     
    tayiper, Apr 27, 2006 IP
  5. Danny

    Danny Active Member

    Messages:
    732
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    78
    #5
    IF it is just a raw HTMl page and you dont have any scripting support you could always use the ASCII values for the code.

    Using the ASCII values means they wont be rendered as HTML but instead as text but they will display the HTML value.

    Dan
     
    Danny, Apr 27, 2006 IP
  6. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #6
    yeah i really want to just show the html code. so i use ascii values is there not a faster way?
     
    mnymkr, Apr 30, 2006 IP
  7. Interact

    Interact Active Member

    Messages:
    175
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    53
    #7
    you can just paste the code in Dreamveawer - in "DESIGN" (preview page).
     
    Interact, May 3, 2006 IP
  8. nirvana4ever

    nirvana4ever Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    use ;lt for < and ;gt for > and replace the < and > signs in the html.

    www.lifehugger.com
     
    nirvana4ever, Mar 11, 2008 IP
  9. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    NeoCambell, Jun 7, 2010 IP
  10. 24788

    24788 Peon

    Messages:
    529
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thread is from 06 bro. I think he got his answer.
     
    24788, Jun 8, 2010 IP
  11. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Exactly. But since there is no answer and Google returns this page from search, I thought I would better add this to help others.
     
    NeoCambell, Jun 8, 2010 IP
  12. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #12
    Just Dreamweaver and NotedPad ++ to do the Job
    If you use WP then there is a plugin for that :)
     
    roopajyothi, Jun 9, 2010 IP