Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7

Thread: Display code

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    19
    Member #
    8655
    How do you display PHP/HTML code on your website without it actually doing anything?

    Ta.
    Vexatomic Design
    www.vexatomic.com

  2.  

  3. #2
    Senior Member Physt's Avatar
    Join Date
    Jul 2004
    Posts
    255
    Member #
    6655
    I know using < and > work, but there is probably an easier way to do it..
    <code>
    &lt;p&gt;stfu&lt;/p&gt;
    </code>
    www.controlalternate.com - Web resources and free templates. www.chaosconcepts.net - Custom web and graphic design.
    www.blog.chaosconcepts.net - My Blog

  4. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    19
    Member #
    8655
    Hmm that didn't work for me. Anyone else?
    Vexatomic Design
    www.vexatomic.com

  5. #4
    Senior Member mixu's Avatar
    Join Date
    Aug 2003
    Posts
    217
    Member #
    2815
    You have two options, either use the PRE tag (I believe there is a CSS2 feature that allows you to use DIV tags too, don't remember now) or your replace each < and > with their HTML escape codes, &lt; and &gt;.

  6. #5
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    PHP also has a built in function called [phpfunction]highlight_file[/phpfunction], that automatically replaces html entities (< br p etc) and colors the code syntax.
    PHP Code:
    $file="some/path/to/file"// or use $_GET['filename'] to retrieve from URL
    highlight_file($file); //Outputs the code color coded 
    S. Rosland

  7. #6
    Member
    Join Date
    Dec 2004
    Posts
    67
    Member #
    8452
    Liked
    1 times
    What are .phps files? Obviously they mean phpsource, but how do you make them? Just the one rosland said?
    Brian : This must be the physics department.
    Chris : That explains all the gravity.

  8. #7
    Member r4nd0mch4r's Avatar
    Join Date
    Sep 2003
    Posts
    40
    Member #
    3271
    Normally, .php files are interpreted by the Web server and all you see is HTML output. If

    - you configure your webserver properly (if apache, then edit httpd.conf)
    - you save your .php file as .phps file

    the output will NOT be HTML output but your PHP code, properly color-formated.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:22 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com