Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How to add code to page?
Old 08-01-2010, 04:38 PM How to add code to page?
Banned

Posts: 39
Trades: 0
I know how to add code to a forum without it executing, you just add these tags:


[CODE][/CODE]


But, how do I do that on an html page where I want people to actually see the sample code?
CyberWizard is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-01-2010, 05:19 PM Re: How to add code to page?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You can't to a HTML page, it needs some scripting

http://www.webmaster-talk.com/html-f...tml#post294819
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-02-2010, 06:18 AM Re: How to add code to page?
Kelpie's Avatar
Skilled Talker

Posts: 82
Name: Andrew
Location: SW Scotland
Trades: 0
To display a section of text as program code, you just place it within html <code></code> tags and use css to style how it appears (advised you use a uniform character width font). So to have it display within a box your css definition might be something like

Code:
code {
    margin: 5px 0;
    padding: 10px;
    font: 0.9em/1.3em 'Lucida Console', 'courier new', monospace;
    background-color: #ffffff;
    border: 1px solid #aaaaaa;  
    text-align: left;
    display: block;
    overflow: auto;  
}
Kelpie is offline
Reply With Quote
View Public Profile
 
Old 08-02-2010, 08:47 AM Re: How to add code to page?
Banned

Posts: 4
Name: bradwatson
Trades: 0
A text area might work. Try it and see.

PHP Code:
<P><TEXTAREA name=textarea rows=4 cols=60

Copy your code and change the rows and columns above to match. (That may not be necessarybut that is the way I have it.  :)  ) 

</
TEXTAREA></P
bradwatson is offline
Reply With Quote
View Public Profile Visit bradwatson's homepage!
 
Old 08-02-2010, 08:28 PM Re: How to add code to page?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by tinaCEO View Post
its very easy to add....
i don't want to tell about it.............
Then why post?


In fact WHY even join a forum, where the general principle is to SHARE knowledge?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-03-2010, 12:16 AM Re: How to add code to page?
Average Talker

Posts: 18
Name: Samual
Trades: 0
the tag which u r saying......is cannot placed directly into the coding........
it need scripting...........
plain html doesnt support it........
shiam is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 06:29 AM Re: How to add code to page?
Experienced Talker

Posts: 39
Trades: 0
Hi CyberWizard, I agree with bradwatson; I've done it for a PHP site (http://www.rimeducation.com/main/addToBlogOrWeb.php), but I'm not sure if it works the same for an HTML page.

However, I found that using Polystyle or Tidy on the page would break the format... all the <table></table> within the <textarea></textarea> needed to remain flush left on the page. I don't know if that is unique to this site or not, but something you might want to remember if troubleshooting.
__________________
The truth is more important than the facts. Frank Lloyd Wright
__________________________________________________ _________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
byte4byte is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 07:14 AM Re: How to add code to page?
Kelpie's Avatar
Skilled Talker

Posts: 82
Name: Andrew
Location: SW Scotland
Trades: 0
Hmm, not exactly correct usage of html tags, but if you insist on using textarea for this, at least have the sense to give it the attribute readonly="yes"
Kelpie is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 07:26 AM Re: How to add code to page?
Experienced Talker

Posts: 39
Trades: 0
Kelpie, thank you for your helpful comment.
__________________
The truth is more important than the facts. Frank Lloyd Wright
__________________________________________________ _________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
byte4byte is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 07:30 AM Re: How to add code to page?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
personally I use both a <pre> elements and a <textarea> on the same page

http://www.modtalk.co.uk/article/c-a...gn/dhtml-tabs/

(use the "Click to switch code view" )
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-03-2010, 07:35 AM Re: How to add code to page?
Experienced Talker

Posts: 39
Trades: 0
chrishirst, this is very helpful; thank you!
__________________
The truth is more important than the facts. Frank Lloyd Wright
__________________________________________________ _________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
byte4byte is offline
Reply With Quote
View Public Profile
 
Old 08-26-2010, 03:51 AM Re: How to add code to page?
Novice Talker

Posts: 4
Name: John
Trades: 0
Put that code in a text area.
<textarea rows="2" cols="20">
you code goes here.
</textarea>
Royal Johnson is offline
Reply With Quote
View Public Profile
 
Old 09-03-2010, 05:10 AM Re: How to add code to page?
Junior Talker

Posts: 1
Name: Aleksey
Location: Earth )
Trades: 0
the best way to show users the main part of your page (code in your case) is to use some text formatting tags. It's wiill be better then text area and others way to do it. IMHO
darkalex is offline
Reply With Quote
View Public Profile
 
Old 09-03-2010, 06:00 AM Re: How to add code to page?
CSM
CSM's Avatar
Front-End Developer

Posts: 297
Name: Michael Pehl
Location: Palma de Mallorca
Trades: 0
Why not using a syntax highlighting script like

http://startbigthinksmall.wordpress....-highlighting/
__________________
Chief Web Officer / Front-End Developer / System Engineer

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
CSM is offline
Reply With Quote
View Public Profile Visit CSM's homepage!
 
Old 09-07-2010, 01:07 AM Re: How to add code to page?
Banned

Posts: 5
Name: David Warner
Trades: 0
When you design and build your own website at QuickontheNet.com, it is extremely easy to add third-party code to your web page. Embedding the code from another supplier is very easy and quite honestly, we could not make it any easier for you if we tried. The possibilities are endless! If you're in business, this feature can add many new opportunities to your business website service, allowing you to take online payments, sell products or services, show money-making advertising, display web search bars, show videos, play music or sound and present animations.
David Warner is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to add code to page?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.72100 seconds with 12 queries