943,947 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1902
  • PHP RSS
Oct 2nd, 2009
0

Formated Source Code

Expand Post »
Code View
In the linked page u can see that source code is properly formated, how to do that??

I am making my web, i want to know that how can i show the c++ source code on my web with proper format.

Q: How to show a formated source code on a HTML Page.

Thanks.
Similar Threads
Reputation Points: 32
Solved Threads: 0
Newbie Poster
AbsoluteCPP is offline Offline
14 posts
since May 2009
Oct 2nd, 2009
0

Re: Formated Source Code

Use <pre></pre> or <code></code> tags around it like:
html Syntax (Toggle Plain Text)
  1. <pre>
  2. #include &lt;iostream&gt;
  3. int main(int argc, char** argv)
  4. {
  5. std::cout &lt;&lt; "Hello World!\n";
  6. return 0;
  7. }
  8. </pre>

Note the &lt; . Make sure you encode any HTML entities (<, >, &, etc.) so they don't get mixed in with the markup
Last edited by ShawnCplus; Oct 2nd, 2009 at 3:48 pm.
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Oct 2nd, 2009
0

Re: Formated Source Code

Reputation Points: 18
Solved Threads: 21
Junior Poster
codejoust is offline Offline
180 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP Confirmation
Next Thread in PHP Forum Timeline: act directly on an array value returned by a function?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC