473,394 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Simple question for once ?


How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
May 11 '07 #1
3 1298
On 11 May, 17:38, harvey <harvey....@blueyonzders.comwrote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
$string = '<h1>likethis</h1>';

echo htmlentities( $string );
//or
echo highlight_string( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

May 11 '07 #2
In article <11**********************@o5g2000hsb.googlegroups. com>,
ma********@gmail.com says...
On 11 May, 17:38, harvey <harvey....@blueyonzders.comwrote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?

IE I want the tags to be printed out - not interpreted.

Thanks
$string = '<h1>likethis</h1>';

echo htmlentities( $string );
//or
echo highlight_string( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

That was fast -
I am a bit red faced as I actually recognise that command but thought it
did something else !

Your second method is a new one to me - I will experiment with that.

thank you !
May 11 '07 #3
On 11 May, 17:51, harvey <harvey....@blueyonzders.comwrote:
In article <1178901903.347883.242...@o5g2000hsb.googlegroups. com>,
matt.fa...@gmail.com says...
On 11 May, 17:38, harvey <harvey....@blueyonzders.comwrote:
How do I get a text string that may contain HTML tags to
echo out to a web browser verbatim?
IE I want the tags to be printed out - not interpreted.
Thanks
$string = '<h1>likethis</h1>';
echo htmlentities( $string );
//or
echo highlight_string( '<?php' . $string . '?>' );
//where adding <?php is a trick to highlight non-php, if you dont
mind the php tags appearing.(u could kill them afterwards)

That was fast -
I am a bit red faced as I actually recognise that command but thought it
did something else !

Your second method is a new one to me - I will experiment with that.

thank you !
well i was too quick for my puny brain
it should be

highlight_string( '<?php ' . $string . ' ?>' );

of course!!

May 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: gaudetteje | last post by:
I've been searching high and low for a way to simply convert a small XML configuration file to Python data structures. I came across gnosis XML tools, but need a built-in option for doing...
27
by: Brian Sabbey | last post by:
Here is a first draft of a PEP for thunks. Please let me know what you think. If there is a positive response, I will create a real PEP. I made a patch that implements thunks as described here....
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
3
by: Iain Miller | last post by:
Can anybody help me with some Access 2000 code? I don't do a lot of coding in Access & so every time I come back to do something I pretty much have to relearn the syntax from scratch so this is...
18
by: Bob Cummings | last post by:
Not sure if this is the correct place or not. Anyhow in school we were taught that when trying to calculate the efficiency of an algorithm to focus on something called FLOPs or Floating Point...
1
by: Chris Lieb | last post by:
I am new to XML Schema and am running into a bit of a snag. I have defined an XML-based scripting language for an updater program that I am working on. I would like to make a schema for this...
8
by: Eric_Dexter | last post by:
I was looking for a simple way to load a simple python program from another python program. I tried os.system(cabel) The file name is cabel.py a csound instrument editor.. The error I am...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
1
joedeene
by: joedeene | last post by:
Hello all, I am using Macromedia Flash Professional 8 in this example of a simple way to use motion tweens. Ok here goes... Directions: A. Preparation 1.) Start the Flash program. Once...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.