Reply
Display code
Old 10-18-2006, 06:45 AM Re: Display code
Experienced Talker

Posts: 36
Name: Brian Collins
That is cool This is not my post But you just showed me a new html tag I never knew of <xmp> It is cleaner then my textera box way.
bmcoll3278 is offline
Reply With Quote
View Public Profile
 
Old 10-18-2006, 03:01 PM Re: Display code
vangogh's Avatar
Post Impressionist

Posts: 8,820
Name: Steven Bradley
Location: Boulder, Colorado
Unfortunately <xmp> has been deprecated so there's no guarantee of it working in the future. <pre> is the recommended tag though it doesn't quite do what <xmp> does.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-13-2008, 02:54 PM Re: Display code
Lashtal's Avatar
Ultra Talker

Posts: 309
Name: Lashtal
Quote:
Originally Posted by chrishirst View Post
it's definitely simpler, write one function, use it wherever it's required.

This one is in ASP VbScript
Code:
function toCode(strItem)
    dim i
'Change code delimiters to HTML entities
    strItem = Replace(strItem,"<","&lt;")
    strItem = Replace(strItem,">","&gt;")
    strItem = Replace(strItem,"%","%")
    strItem = replace(strItem,chr(34),"&quot;")
toCode = strItem    
end function
Use would be
Code:
 response.write tocode("<h1>Blah</h1>")
PHP would be
PHP Code:
function toCode($strItem) {
           
$html = array("<",">",chr(34));
           
$entities = array("&lt;","&gt;","&quot;");
           
$strItem str_replace($html$entities$strItem);
return 
$strItem;

Use would be
PHP Code:
echo toCode('<h1>Blah</h1>'); 

This is the post i'm sure you were referring to, after the Character Entities discussion we had.
__________________
www.LuciferCosmetics.com
Lashtal is offline
Reply With Quote
View Public Profile
 
Old 03-14-2008, 02:23 AM Re: Display code
RadGH's Avatar
Experienced Talker

Posts: 48
Name: Radley
Well you already have several answers on how to build it yourself, but you can also get a PHP script that does it for you (and more).

GeSHi - Supports syntax highlighting and many programming/markup languages and is highly customizable. I haven't personally used it, but my friend recommended it to me and his site used it (way back when I didn't know anything php).

Might give that a try

EDIT: Neat, you can even click on the tags and they link you to a definition and list parameters etc. I think I'm going to build something and put this to use now :P
RadGH is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Display code

Thread Tools

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

vB 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 0.17071 seconds with 11 queries